Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode9 Realm Error - No viable overloaded ‘=’

Tags:

c++

xcode

ios

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);

like image 707
Jone Avatar asked Jun 09 '17 02:06

Jone


2 Answers

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!

like image 98
antonioduarte Avatar answered Sep 27 '22 23:09

antonioduarte


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.

like image 28
David Fournier Avatar answered Sep 27 '22 22:09

David Fournier