Alan
Alan

Reputation: 9471

Realm using xCode 8 & Swift 2.3 Failing

I recently updated to xCode 8 and I am choosing to stay with Swift 2.3

I am using Cocoapods to integrate Realm and it was working prior to the upgrade to xCode 8.

I searched around on Realm's GitHub and tried some solutions to no success. In my podfile I have the following lines for Realm

pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '2.3'
    end
  end
end

It installs successfully completes with message:

Using Realm (1.1.0) Using RealmSwift (1.1.0)

When I relaunch my application:

Upvotes: 2

Views: 640

Answers (2)

Tindi_
Tindi_

Reputation: 17

I was faced with the same problem. My Podfile looks similar to yours but I have this edit:

pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
pod 'RealmSwift', '~> 2.3.0'

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
    config.build_settings['SWIFT_VERSION'] = '2.3'
   end
  end
end

As of v2.4.0, Swift 2.x is no longer supported. Realm 2.3.0 is the last stable version that supports Swift 2.3. Also as Soundshock says ensure you have 'User Legacy Swift Language version' to 'YES' for RealmSwift Pod Target. Hope this helps.

Upvotes: 0

SoundShock
SoundShock

Reputation: 485

I've had the exact same issue, and solved it my putting my 'User Legacy Swift Language version' to 'YES' for that Pod. enter image description here

Upvotes: 1

Related Questions