realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.31k stars 2.15k forks source link

Incompatibility between Facebook SDK 4.35.0 and Realm 3.7.6 #5895

Closed spriggyjeff closed 6 years ago

spriggyjeff commented 6 years ago

Goals

Use both Realm and Facebook pods in my app.

Note: Probably not an issue with Realm, but posting here just in case.

Previous versions up to Facebook SDK 4.33 worked fine. As of Facebook SDK 4.35 things are broken. The problem is probably in Facebook's SDK and a bug has been filed here:

https://developers.facebook.com/support/bugs/1897743506960308/?disable_redirect=0

Expected Results

App does not crash.

Actual Results

Crash on startup in Facebook SDK: 2018-08-28 02:53:07.852242+1000 Facebook Crash Example[4086:1158284] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' +[NSString stringWithUTF8String:]: NULL cString' *** First throw call stack: (0x18391ed8c 0x182ad85ec 0x18391ec6c 0x1842580a0 0x104ac46c0 0x104ac4384 0x104ac4190 0x104ac4c40 0x104ac1134 0x182ada9f0 0x182adbb58 0x1055020c8 0x10551212c 0x1055111cc 0x105511288 0x105502498 0x1055070fc 0x10550121c) libc++abi.dylib: terminating with uncaught exception of type NSException

Facebook Crash Example was compiled with optimization - stepping may behave oddly; variables may not be available.

Steps to Reproduce

Build and run the sample project.

Code Sample

https://github.com/spriggyjeff/facebook-crash-example

Version of Realm and Tooling

ProductName:    Mac OS X
ProductVersion: 10.13.6
BuildVersion:   17G65

/Applications/_Xcode_9.4.app/Contents/Developer
Xcode 9.4
Build version 9F1027a

/Users/jeff/homebrew/bin/pod
1.6.0.beta.1
Realm (3.7.6)
RealmSwift (3.7.6)

/bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)

/Users/jeff/homebrew/bin/carthage
0.25.0
(not in use here)

/usr/bin/git
git version 2.15.1 (Apple Git-101)
tgoyne commented 6 years ago

From the stack trace I can guess that it's calling an objc runtime function on RealmSwift.Object which returns a string and is getting a null string when it's not expecting one, but there aren't really any hints about what the problematic thing is. We don't do any weird runtime things to RealmSwift.Object, so I don't think it's our bug. Maybe they don't handle @objc(RealmSwiftObject) making the obj-c name different from the Swift name correctly?

spriggyjeff commented 6 years ago

Facebook have assigned this to one of their teams. Thanks for the additional info!

spriggyjeff commented 6 years ago

This has been fixed in Facebook SDK 4.36.0.

realm-probot[bot] commented 6 years ago

Hey - looks like you forgot to add a T:* label - could you please add one?