简体   繁体   中英

Xcode9 Realm Error - No viable overloaded ‘=’

I just install Xcode 9 and build my native iOS project. (Is written in swift)

The project was OK in Xcode 8 but now, I obtain this error:

No viable overloaded '='

In the file: Pods\\Pods\\Realm\\object.cpp

Line 42 => m_notifier = std::make_shared<_impl::ObjectNotifier>(m_row, m_realm);

If you are using Cocoapods, open up the Podfile and set the RealmSwift version to 2.8.1 (or 2.8.3 as David mentioned above). Here is my Podfile for Swift 3.0 using Xcode 9:

target ‘<PROJECT>’ do
  use_frameworks!

  # Pods
  ...
  pod 'RealmSwift', '2.8.1'
end

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

Then, save the file and run:

pod install

If you're not setting a specific pod version (which I recommend), run the following command:

pod update RealmSwift

and it will automatically update to the most recent version (2.8.3).

Hope it helps to complement David's answer. Thanks!

The Realm team has worked on a new version allowing you to build your project with XCode 9. Just update your Realm version to at least 2.8.1 (current version is 2.8.3 )

https://github.com/realm/realm-cocoa/releases/tag/v2.8.1

The Realm release note of 2.8.1 clearly states :

Add support for building with Xcode 9 Beta 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM