Facebook SDK 7.1.0 integration crash?

Having upgraded the Facebook SDK to 7.1.0 having followed the upgrade guide, it all builds and runs fine in the editor. Although the Editor version doesn’t simulate the modal display of the SafariViewController.

Guide:

I’ve been able to set the Facebook SDK example scene as my main scene, build and run on an iOS device and have it all run fine and login without issue.

My issue is with my implementation. When I build and run on an iOS device, the new Facebook SDK uses the SafariViewController and popups a login window. I enter my login details and login, then I see the permission screen and hit ok. This is the point of failure, and the error message suggests an issue with nested iteration.

So my question is what has changed in the Facebook SDK that could cause this? Could this be an issue with the SDK? It seems unlikely as the example runs fine. However I didn’t experience this issue with the previous SDK.

I’m left a little stumped on this one. Any help would be appreciated. I’ve attached screenshots and dumped the console error log on pastebin Facebook Unity SDK 7.1.0 Crash - Pastebin.com

I ran into the same issue. If you go into UnityAppController+ViewHandling.mm in xcode, you should find the createSnapshotView , returning nil will stop the crash, but i am not sure what side effects it will have. The weird thing is that If i am not using ADBannerView then it won’t crash, is that the case for you?
I have filed a bug to Unity, will wait and see what they say.

Returning nil will make the problem go away, but I talked with Unity support and a robust fix was made in Unity 5.3.4p3.

Case 775710:

The case description doesn’t really reflect the issue we were seeing, but they are now guarding the call to createSnapshotView such that the view hierarchy shouldn’t be modified during iteration.

Also, for reference the symbolicated crash stack is like this:

NSInternalInconsistencyException
Reason: can't start iterating in the middle of an iteration
    0	  CoreFoundation                     	0x2125398b __exceptionPreprocess + 124
    1	  libobjc.A.dylib                    	0x209eee17 objc_exception_throw + 36
    2	  CoreFoundation                     	0x21253861 +[NSException raise:format:arguments:] + 102
    3	  Foundation                         	0x21a37509 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90
    4	  FrontBoardServices                 	0x228e8fff -[FBSSettingsDiffInspector inspectDiff:withContext:] + 160
    5	  UIKit                              	0x25a5f333 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 100
    6	  UIKit                              	0x25a5f041 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 642
    7	  FrontBoardServices                 	0x228dbcf5 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_2 + 38
    8	  FrontBoardServices                 	0x228f6c07 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    9	  FrontBoardServices                 	0x228f6ab9 -[FBSSerialQueue _performNext] + 222
    10	 FrontBoardServices                 	0x228df4cd -[FBSWorkspace synchronizeSystemAnimationFencesWithCleanUpBlock:] + 1326
    11	 UIKit                              	0x25a5cb41 -[UIApplication _synchronizeSystemAnimationFencesWithSpinCleanUpBlock:] + 430
    12	 UIKit                              	0x25aaf66d __realPreCommitHandler_block_invoke + 398
    13	 QuartzCore                         	0x23896247 CA::Transaction::Fence::run_callbacks() + 24
    14	 QuartzCore                         	0x2385c68f CA::Context::commit_transaction() + 636
    15	 QuartzCore                         	0x2385c233 CA::Transaction::commit() + 612
    16	 UIKit                              	0x25c3022d +[UIScreen _beginDisableScreenUpdatesForSnapshotUsingSnapshotCover:] + 374
    17	 UIKit                              	0x25ac0f99 __73-[UIView resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:]_block_invoke + 74
    18	 UIKit                              	0x25acdf93 +[_UIReplicantView _pendingSnapshotOfTarget:snapshotBlock:] + 376
    19	 UIKit                              	0x25ac0e91 -[UIView resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:] + 238
    20	 UIKit                              	0x25ac0d99 -[UIView snapshotViewAfterScreenUpdates:] + 134
    ...
23	 UIKit                              	0x2582a0bd -[UIApplication _deactivateForReason:notify:] + 698

Our crashes were occurring when users would background the app during the startup sequence. Reason being that removing the splash screen and showing our game UI would change the view hierarchy.

Another variant of this issue was fixed in Unity 5.3.2.p4 with case 760747. The repro for that was to have the onscreen keyboard open when the app is backgrounded.