Hey all,
Basically I a trying to make our game run on the iPhone, works totally fine on Android, but each time the game runs I see the loading splash and then it crashes. I have been following this thread but their solutions don’t seem to make a difference for me:
http://forum.unity3d.com/threads/black-screen-on-ios-device-beta14.282154/
This crashes on the line:
return [_displayConnection objectForKey:(UIScreen*)key];
In the file DisplayManger.mm, method objectForKeyedSubscript()
If I follow the stack trace for the thread is first gets called by the UnityAppController.mm on the line/method:
[[DisplayManager Instance] updateDisplayListInUnity];
Not going to lie I am completely stumped!
Any ideas or suggestions welcome. Oh I have tried a build with a blank project and just a spinning cube, works totally fine
For me, this only became fixed when I edited Classes/Unity/DisplayManager.mm, line 277, to say:
_displayConnection = [[NSMapTable
mapTableWithKeyOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality
valueOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality
] retain];
It seems strange that I need to make this change, but others do not. However, this allowed the app to continue running.
I “had” the same issue but looks like I solved it!
For me, to be able to build my app for Facebook, I had to disable the arc just like mentioned below:
After that, my problem about build was gone and I was able to load it to my iPhone6. But after play, I had the same issue as you mentioned. When I debugged for _displayConnection object, reference pointer inside of the object was null. (Don’t know Objective-C, just C++ so sorry about syntax!)
What did I do? Well:
First, I set ALL files’ flags with -fno-objc-arc flag as mentioned on the link! Why all? Because it was easier! But as far as I can see, only one file; FBUnityInterface.mm needs to be corrected this way! When I remove compiler flag from rest, my app is working fine right now!!! So set compiler flag for FBUnityInterface.mm and leave rest!
I’m using Unity 5 Personel, Facebook SDK 6.2.1. Target device is iPhone 6 and I set iOS 8.1 on my platform settings for iOS and Unity.
Hope this helps you too!!!
I had a similar issue. it was crashing on the below line.
- (BOOL)displayAvailable:(UIScreen*)targetScreen;
{
return self[targetScreen] != nil;
}
It was caused because I disabled Automatic reference counting (ARC) in the Xcode project settings. Re-enabling it fixed the issue. If you don’t want to use ARC in your code add -fno-objc-arc flag to your Objective-C script.