Realm-cocoa: Error with RealmSwift on Xcode 7.3

Created on 23 Mar 2016  Â·  23Comments  Â·  Source: realm/realm-cocoa

Goals

What do you want to achieve?
Run Realm on Xcode with an BAD Access on this line:

malloc_ptr classes(objc_copyClassList(&numClasses), &free);

This line is 228 on RLMSchema.mm.

Expected Results

What did you expected to happen?
Run Realm on 7.3 xCode.

Actual Results

What did happened instead?
e.g. the stack trace of a crash
Not works more my app, I am receiving this crash error:
Thread 1: EXC_BAD_ACCESS

Steps to Reproduce

What are steps we can follow to reproduce this issue?

I just try to run my same project on Xcode 7.3.

Code Sample

Provide a code sample or test case that highlights the issue.
If relevant, include your model definitions.
For larger code samples, links to external gists/repositories are preferred.
Alternatively share confidentially via mail to [email protected].
Full Xcode projects that we can compile ourselves are ideal!

Version of Realm and Tooling

In the CONTRIBUTING guidelines, you will find a script,
which will help determining these versions.

Realm version: 0.98.5

Xcode version: 7.3

iOS/OSX version: 10.11.4

Dependency manager + version: ?

Reproduction-Required T-Bug-Crash

All 23 comments

There was another ticket about this. They closed it after explaining that Apple does not guarantee binary compatibility. But they did not make a release.

@codeslubber it's possible this issue is unrelated with the Realm Swift binary incompatibility mentioned in other issues.

A release of Realm Swift built with Xcode 7.3 is blocked on https://github.com/realm/realm-cocoa/pull/3361#issuecomment-200500431. Feel free to help if you're so inclined.

How? by trying to run the tests in Xcode? Looks like you have hit the wall there.

Have you talked to anyone at Apple? I would show this to the Xcode PM.

On Mar 23, 2016, at 12:13 PM, JP Simard [email protected] wrote:

@codeslubber https://github.com/codeslubber it's possible this issue is unrelated with the Realm Swift binary incompatibility mentioned in other issues.

A release of Realm Swift built with Xcode 7.3 is blocked on #3361 (comment) https://github.com/realm/realm-cocoa/pull/3361#issuecomment-200500431. Feel free to help if you're so inclined.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub https://github.com/realm/realm-cocoa/issues/3366#issuecomment-200500725

How? by trying to run the tests in Xcode? Looks like you have hit the wall there.

We're not quite that quick to give up! We're still investigating and looking for a workaround, I'm just providing some transparency into the process.

Have you talked to anyone at Apple? I would show this to the Xcode PM.

We're still gathering information to determine if this is a bug in Xcode or something misconfigured in our project. We'll file a radar with Apple if it's the former.

@jpsim I saw your comment about having pods build from source to get around the issue. You provided an example with carthage of how to do it, per chance do you know how I can have pods build from source instead of using the binaries?

Hi I opened a similar issue yesterday, but it was closed since it's a duplicate. Since I am using Realm with Carthage, I tried carthage update --no-use-binaries without success. At the end I returned to XCODE 7.2 for now which is terrible since I updated my devices to iOS 9.3 and now XCODE 7.2 cannot build on them :(. I also tried integrating it directly but in vain. What is the situation with process of upgrading our CI infrastructure to use El Capitan and Xcode 7.3?

FWIW, we ended up just cloning the repo and building locally then dropping the Frameworks into the directory. Sadly, going back to CoreData for next project.

@pavlem I also had to return to XCode 7.2.1, but I have managed to be able to build onto my iOS 9.3 device. Go into the contents folder of your XCode7.3(in Finder/Applications/XCode)/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport and copy the folder called "9.3 (13E230)" into the corresponding location of your XCode 7.2.1 installation, and that should make you able to use your device for testing.

Realm Guys! Are you working on this problem? This is a serious issue (considering that XC7.3 with Swift 2.2 compiler has been available for quite some time...). Also I would really appreciate, if you guys could notify us the next time, when updating to the next Swift/XCode version breaks the compilation of our Realm projects.

PS.: Using newest Realm-Swift as prebuilt dynamic framework.

This issue need to be resolved ASAP. I recently re-wrote my main project with Realm. Now I can't proceed.

New Xcode releases often bring incompatibilities that prevent us from deploying them in our continuous integration system immediately. In the case of Xcode 7.3 there were changes to how it handles unit test targets that prevented us from running tests on iOS devices. Without the ability to test on iOS devices we're unable to verify that any build we produce is of sufficient quality to release. We've recently wrapped up fixes for the issues we were encountering (see #3361), and will be looking to get a new point release of Realm out in the next 12 hours or so.

Also I would really appreciate, if you guys could notify us the next time, when updating to the next Swift/XCode version breaks the compilation of our Realm projects.

This issue of binary compatibility is not unique to Realm. Apple has been very clear about Swift's binary compatibility guarantees: there are none. You cannot mix Swift code built with with different versions of Xcode in the same application. If you're using pre-built libraries, you _must_ use the version of Xcode that the library was built with. If you want to use a newer version of Xcode, you _must_ build all of your Swift dependencies from source. You can do this using CocoaPods or with Carthage's --no-use-binaries option.

The hard work is of course appreciated, however I've tried this with pods and building from source, as others have indicated, even building from source while solving the problem of being able to build your app, when trying to send that build up to itunes, the builds were being rejected.

Thank you for all the effort and looking forward to the release.

I've only seen one person mention that their uploaded builds were being rejected by iTunes Connect, and that turned out to be due to missing the script phase that remove the simulators slices from the Realm frameworks when building for devices (the final step in the installation instructions of both the Dynamic Framework and Carthage approaches to integrating Realm). If you're experiencing a problem along these lines I'd encourage you to file a new issue with more details about the problem you're seeing so we can help you troubleshoot.

We have just released Realm Swift v0.98.6, built with Xcode 7.3.

@RafaelPlantard, I'm not clear from your original report if the issue you're seeing is due to the Swift ABI issues that other people have piled on here to discuss. I'd appreciate if you could update to v0.98.6 when you have a chance and let us know if it addresses your problem.

Yesterday I made realm work with my project in XCODE 7.3 and Swift 2.2. I followed instructions on #3364 from "antfarm". Additionally I removed from "Build phases" in "Run Script" "$(SRCROOT)/Carthage/Build/iOS/Realm.framework", "$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework"
I dragged built frameworks to "Embeded binaries" It worked at the end :)

@bdash Hey there! I just tried our project with AppStore-XC7.3, it compiles and runs with the prebuilt dynamic framework of Realm Swift v0.98.6. Thank you guys for the updated version!

Could you guys please write some warnings about the issues that might occour when updating XCode on https://realm.io/docs/swift/?

Still getting the error with build 0.98.6 . Using cocoapods 0.39.0 . When trying to integrate realm swift into empty project it compiles, but my original project is still not working (EXC_BAD_ACCESS at RLMSchema.mm:228). I also got the error when using precompiled frameworks from github download page

@peterturza, can you please share the full error message you're seeing in a fresh, new GitHub issue?

I will try it now
@bdash

Same error, not working for me, this new version, same error, same line, same description, BAD_ACCESS...
@bdash

Thanks for letting me know, @RafaelPlantard. Are you willing to share a build of your application (e.g., the .app or .ipa) compiled for an iOS device that reproduces the crash? I can take a look at it to help understand what's going on. If you're willing, please share the built app with [email protected] and mention this GitHub issue number in your email.

I sent to you...

Thanks for sending that over, @RafaelPlantard.

This is a Swift compiler bug. Caesar Wirth has written up a blog post about the issue, including a workaround you can apply in your application. He also links to the Swift compiler bug report that is being used to track the compiler fix.

Thanks :+1:
It's worked...

Was this page helpful?
0 / 5 - 0 ratings