Realm-cocoa: Swift Compiler Error for Xcode 8 and Swift 2.3

Created on 27 Jul 2016  路  13Comments  路  Source: realm/realm-cocoa

Goals

I want to migrate a project from Xcode 7.3 and Swift 2.2 to Xcode 8 and Swift 2.3.

Expected Results

I am downloading the latest version of Realm and RealmSwift, 1.0.2. Expected code to compile.

Actual Results

Received compiler error:
"Type 'RLMRealm' has no member 'performMigrationForConfiguration'"
in file Pods/RealmSwift/Migration.swift

Steps to Reproduce

I thought this might be problem with the existing project, but was able to reproduce the error as follows:
Create a new single application project in Xcode 8. Pod init. Added RealmSwift to the podfile with this code:

pod 'RealmSwift', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'master'

Pod install. Converted code to Swift 2.3. Cleaned project, then ran project. Received Error.

Help would be appreciated!!!

T-Help

Most helpful comment

It looks like for older versions of cocoapods (0.39 in my case) you need the following:

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

All 13 comments

You're using Realm Swift from master so you need to tell CocoaPods to also use Realm Objective-C from master:

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

Otherwise CocoaPods will try to use Realm Swift from our Git master against the most recent release of Realm Objective-C, which isn't likely to work.

Awesome! Thanks @bdash, that solved the issue!

It looks like for older versions of cocoapods (0.39 in my case) you need the following:

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

@brynjar I did that and I get these errors:

captura de pantalla 2016-09-14 a las 3 08 54 a m

I still can not use realm with Xcode 8

From the top error in your screenshot - did you do a clean build?

@brynjar ok I did a clean build and it works, thank you !!

I was using RealmSwift 2.1.2. I recently updated to RealmSwift 2.4.3.

Using Swift 2.3
Cocoapods 1.2.0

While I built the project, it produces a list of 483 Build errors in RealmSwift pod.
screen shot 2017-02-21 at 4 38 20 pm

Please help me.

As of v2.4.0, Swift 2.x is no longer supported.

@bdash Thanks

@alejandro-menendez what did you do instead? I have the exact same issue.

@Tindi as of now I am using 2.3.0 ( pod 'RealmSwift', '2.3.0' ).

@alejandro-menendez yeah did the same. But thanks for your response! I'll migrate to Swift 3 soon.

@Tindi same here

Was this page helpful?
0 / 5 - 0 ratings