algolia / instantsearch-core-swift

⚡️ InstantSearch Core library for Swift and Objective-C
https://community.algolia.com/instantsearch-core-swift/
Apache License 2.0
18 stars 10 forks source link

Swift Compiler Error #21

Closed christianpbrink closed 6 years ago

christianpbrink commented 6 years ago
/Pods/InstantSearch-Core-Swift/Sources/Highlighter.swift:86:44: Cannot convert value of type '[NSAttributedStringKey : Any]' (aka 'Dictionary<NSString, Any>') to expected argument type '[String : Any]'

Anyone have insight? I've tried with both Swift 3.3 and Swift 4.1.

spinach commented 6 years ago

Hey @christianpbrink,

can you use our latest version 3, it should solve your problem:

pod 'InstantSearch-Core-Swift', '~> 3.0'

This backward incompatibility issue was mentioned in our release notes. I just noticed that our docs were not updated to point out this new version change, will make sure to update that, thanks!

christianpbrink commented 6 years ago

Thank you!!

On Thu, Apr 19, 2018 at 9:02 AM, Guy Daher notifications@github.com wrote:

Closed #21 https://github.com/algolia/instantsearch-core-swift/issues/21 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/algolia/instantsearch-core-swift/issues/21#event-1583743254, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbap4yMzaXVZEVFgds07mjufWM43Q_Kks5tqIrwgaJpZM4TbscT .

christianpbrink commented 6 years ago

Hm -- actually it doesn't seem to work. Turns out I already had InstantSearch-Core-Swift @ 3.2.1.

On Thu, Apr 19, 2018 at 9:03 AM, Christian Brink christianpbrink@gmail.com wrote:

Thank you!!

On Thu, Apr 19, 2018 at 9:02 AM, Guy Daher notifications@github.com wrote:

Closed #21 https://github.com/algolia/instantsearch-core-swift/issues/21.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/algolia/instantsearch-core-swift/issues/21#event-1583743254, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbap4yMzaXVZEVFgds07mjufWM43Q_Kks5tqIrwgaJpZM4TbscT .

spinach commented 6 years ago

Can you tell me which XCode version you’re using?

Also if you can paste your Podfile it would be great!

christianpbrink commented 6 years ago

Yes, it's Xcode Version 9.3 (9E145). Here's my Podfile:

platform :ios, '9.0'
use_frameworks!

project 'Audm', {
    'Hockey Test' => :debug,
    'Local (External)' => :debug,
    'Local (Simulator)' => :debug,
}

target 'Audm' do
pod 'Dollar', '6.1.0'
pod 'Cent', '6.0.3'
pod 'DACircularProgress', '2.3.1'
pod 'Bolts/Tasks', '1.8'
pod 'Parse', '1.15.3'
pod 'ParseUI', :git => 'https://github.com/ParsePlatform/ParseUI-iOS', :commit => '1ea5f5c4b239b39fb5f8039e01661da83afb4ca9'
pod 'ReachabilitySwift', '~> 3'
pod 'HockeySDK', '3.8.6'
pod 'FBSDKLoginKit', '4.28.0'
pod 'ParseFacebookUtilsV4', '1.11.1'
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :branch => 'master'
pod 'Analytics', '3.2.5'
pod 'CocoaLumberjack/Swift', '3.1.0'
pod 'PaperTrailLumberjack/Swift', '0.1.8'
pod 'Mixpanel', '3.0.0'
pod 'ISO8601', '0.6.0'
pod 'SwifterSwift', '1.6.3'
pod 'Fabric'
pod 'Crashlytics'
pod 'Adjust', '~> 4.11.4'
pod 'SwiftRichString', '0.9.10'
pod 'Intercom'
pod 'InstantSearch-Core-Swift', '3.0.0'
pod 'InstantSearch-iOS', '~> 2.0.0'
end
christianpbrink commented 6 years ago

Btw that version specification on InstantSearch-Core-Swift is only the most recent one I've tried. As I mentioned, I was previously at 3.2.1.

spinach commented 6 years ago

Okay, I quickly tried it on my side.

Can you try the following:

1- Remove the InstantSearch-Core-Swift dependency 2- Change the InstantSearch-iOS one to pod 'InstantSearch-iOS', '~> 2.1.0' 3- run pod update and not pod install.

If it doesn't work, can you run xcode-select -print-path and make sure that your xcode build system is using the latest XCode?

christianpbrink commented 6 years ago

Terrific, I’ll get to this in a few hours. Thank you.

On Thu, Apr 19, 2018 at 11:54 AM Guy Daher notifications@github.com wrote:

Okay, I quickly tried it on my side.

Can you try the following:

1- Remove the InstantSearch-Core-Swift dependency 2- Change the InstantSearch-iOS one to pod 'InstantSearch-iOS', '~> 2.1.0' 3- run pod update and not pod install.

If it doesn't work, can you run xcode-select -print-path and make sure that your xcode build system is using the latest XCode?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/algolia/instantsearch-core-swift/issues/21#issuecomment-382787737, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbap07y9XNaAbh7xskhXHNRUV542Xo6ks5tqLMngaJpZM4TbscT .

-- Sent from my iPhone

christianpbrink commented 6 years ago

Didn't work. xcode-select -print-path gives me this:

/Applications/Xcode.app/Contents/Developer

Is that useful info?

spinach commented 6 years ago

So in your workspace, if you click on "Pods" project, then on InstantSearch-Core target (refer to screenshot below), what do you see in the swift version of the build settings? When it was Swift 4.1, my project built, and when I changed it to Swift 3.3 it fails with the error that you have

Swift 3.3 fails

image

Swift 4.1 succeeds

image

So What I would do:

1- Ensure that you're building with Swift 4.1 (else do something similar to what is shown in this SO) 2- Delete your DerivedData at /Users/{username}/Library/Developer/Xcode/DerivedData 3- Re-run pod update

Also, if nothing really works, can you just create a new project and add pod 'InstantSearch-iOS', '~> 2.1.0' and see if you also get the same error?

At the end, I think it's a problem with versioning and caching of pods.

christianpbrink commented 6 years ago

Slam dunk. I was setting my own project files to build with Swift 4.1, but that preference wasn't being automatically mirrored for the Pods as I thought it would be.

Thank you for your patience and help!

spinach commented 6 years ago

Glad to hear it worked, cheers!