Unity iOS app's screen goes black on startup, but still appears to be running - ios

I'm using Unity Pro 4.5.3f3 + iOS Pro 4.x, Xcode 5.1.1, and tested with an iPhone 4S and 5 running iOS 7.1.2.
I recently took over development of an iOS app from a departing coworker at my game studio, and I'm attempting to compile the app in Xcode on my own machine for the first time. I have followed his instructions for which extra Obj-C code to add manually. The app works perfectly in Unity. Everything builds in Xcode without errors.
When the app runs, I see the custom splash screen loading as intended, but then the screen goes completely black. The app appears to be running fine...I can hear its sounds playing and it even responds when I tap the screen in areas where I know the buttons are supposed to be. There are no errors thrown to the log. But it doesn't display any graphics at all!
I suspect the Prime[31] plugin has something to do with it, as I get a strange log output saying Prime[31] didn't recognize several other plugins. And I can't delete it to test my theory, because way too many scripts depend on it.
Does anyone know how to fix this? I have lots of tasks to do for this app and I can't let something like this slow me down.

I encountered this issue last night when trying to configure my app to be compatible with Facebook Canvas.
Below is the line of code that was breaking:
FB.Canvas.SetAspectRatio(9,16, FBScreen.CenterHorizontal(), FBScreen.CenterVertical());
To fix my issue I surrounded the line with the UNITY_WEBPLAYER preprocessor directive like so:
#if UNITY_WEBPLAYER
FB.Canvas.SetAspectRatio(9,16, FBScreen.CenterHorizontal(), FBScreen.CenterVertical());
#endif
Doing this causes that line of code to only be compiled and run in the web player, and not on the mobile device. Hope that helps!

Related

iOS Swift game crashing on everyones iPhone, except mine

I've been developing a small "Cookie Clicker" style game for a while now and all of the sudden, the app will instantly crash upon opening. It doesn't crash on my own phone that I've been running the tests on, however, anyone that downloads it from TestFlight cannot even open it. It runs perfectly on the Xcode simulator as well.
Out of desperation, I completely backtracked the update that started the crashes (deleted all the new code for the menu I was working on) but it STILL CRASHES.
I don't want to copy/paste the code here because it is 16,000+ lines and I don't even know which aspect could be affecting it. I am using Xcode 11 and Swift.
If anyone has encountered this problem before and knows even where to start looking for the problem, any help is appreciated.
You need to download the crashlogs from Testflight, re-sybolicate them, and see where it's crashing. Download them from https://appstoreconnect.apple.com/ where you manage TestFlight. Here's an example:
Inside the download is generally two files:
crashlog.crash -- this is the actual crash
feedback.json -- any input provided by the user when it crashed
The .crash file can be re-symbolicated in Xcode as needed and you can see exactly which line caused the crash.

EXC_BAD_ACCESS when trying to run Unity game on iOS simulator

I'm usually not a Mac/Xcode user, please forgive me for incorrect terms or understandings.
I have a 2D Unity game which I can successfully build and run on Android and Windows Phone devices/emulators. When building for iOS, I can successfully create the Xcode project, open it and build the app in there. The only change in the iOS-specific player settings I made was to set SDK Version to Simulator SDK.
However, when trying to run it inside the simulator, the splash screen appears, then Xcode pauses on something that looks like an assemby file with an error message: Thread 1: EXC_BAD_ACCESS (code=1, address=0x4).
As I had no idea on what to do, I started stripping down my project (in Unity) until I had no more gameObjects but the camera left on the start scene. Also, I removed all other scenes from the build. The only thing that changed was that above error message now seems to appear on another assembly file.
What could be the issue here? How should I investigate further?
Update
This is the stacktrace:
Update 2
I've created a new blank Unity project, and I get the exactly same error there. The problem seems to be related to Unity or my machine, not the app itself.
Workaround
After days of researching, I still couldn't resolve the issue and finally built for a real devices instead of the simulator. Since I don't own one, I "blindly" submitted the result to the app store, and it got accepted.
For me, that's the proof that the issue is solely related to the combination of Unity and the iOS simulator, i.e. that those two don't work together reliably.
On the other hand, it seems relatively safe to assume that an app will work on iOS if it's been successfully tested on Android, Windows Phone and the default player. Of course, unless iOS-specific features are implemented.
I only know one reason, that leads to this behaviour (device builds work, but simulator builds won't).
=> This could happen, when using native iOS code / plugins
To fix that, you'll have to modify the <path-to-xcode-project>/Libraries/RegisterMonoModules.cpp file, cause somehow Unity does not register those classes/methods for the simulator.
Just look for #if !(TARGET_IPHONE_SIMULATOR) defines and shift them to have all your plugins included, also in the simulator. There will be some move mono_dl_register_symbol() that you'll need.

Launching app on iOS Simulator (waxsim no longer works)

I've had a workflow for a while that ran automated tests by building an app for the simulator, then launching it using waxsim. On every new sdk release there were some small tweaks to keep it working. However, XCode 5.1 removed the iPhoneSimulatorRemoteClient framework, so waxsim no longer works.
I tried using the ios simulator from the command line directly, as in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /mydir/myapp.app/myapp
However myapp does not run, I just get the simulator loading the home screen. I can't figure out what might be going wrong, since I can't find a way to get any verbose output - the simulator does not complain about anything, it just doesn't load my app.
Any ideas, thoughts? Perhaps an alternative to waxsim that works on Xcode 5.1?
ios-sim was recently updated to support the new private framework DVTiPhoneSimulatorRemoteClient that is present in the current Xcode/SDK. I tried it and it seems to work fine, so I pretty much answered my main question.
Still, if someone has an idea why -SimulateApplication does not work (when the same app launches fine with ios-sim), I'd be curious to find out.

Cordova iOS: Alert-Popups and Device-Ready is not firing

I just set up a new PhoneGap project for android, which worked perfectly fine without any problems, there were almost no changes to the template project.
Then I wanted to move that exact project to iOS, and the woes began.
When I start the project, suddenly a bunch of alter dialogs pop up, with device information, network status. Each offer me "ok" and "cancel". When I press "ok" on any of them, execution is halted, and nothing happens further.
When I cancel them all, I get to the project screen, where it says "connecting to device". Obviously, deviceready is never fired on this.
Since this project is merely the template offered by Cordova themselves, I find it hard to believe it is not supposed to run. I suspect the console.log messages get popped up on screen rather than the XCode debug window.
I am completely new to XCode or any iOS programming (hence PhoneGap), and I would appreciate any help.
Using Cordova 2.8.1.
Reason was I mistakenly copies the cordova.js for android into the ios project, see here.

Why does my app work in the simulator but get stuck on the splash screen when I run it on my iPhone?

My app runs fine on the simulator. However, when I run it on my iPhone, it gets as far as displaying the splash screen and then just stays there. It's an iPhone 3GS and the software version is 5.0.1. That's what happens when Debugger = None. When Debugger = GDB, I get an error message, 'Thread 1: Program received signal: "SIGABRT"', which I have learned can mean almost anything. I'm running Xcode 4.2.1.
I'm coming off a long hard night of battling with this error message, which appeared seemingly out of nowhere in a stable mature app. I tried to roll back with time machine, I deleted the Derived data for my project in Organizer a few times and did some of the other stuff recommended in this thread.
XCode 4 hangs at "Attaching to (app name)"
It got ugly. For a while, I couldn't even reboot my machine. Eventually, I was able to relaunch finder and suddenly the Simulator was working again. Two more pieces of information, I used to have to click allow in two dialog boxes when running on my phone but now it's only one (the one about code signing, I forget what the other one was about). Second, I find all the build architecture target stuff confusing but I set all my Base SDKs to be latest iOS. Lastly, I tried Product --> Clean and then Build but that didn't fix it. As you may have gathered, I'm getting my butt kicked. Any help would be much appreciated.
Dessie
Many times I have experienced Xcode going "crazy" with a physical device connected. At times I saw the behavior you describes; other the app simply refused to start;
In all of those cases, I could fixed it in either of two ways:
disconnect the iphone and connect it again;
reboot the device.
This is a very common problem that is easily fixable.
1) remove the app from the device
2) reboot the device
3) close Xcode and you must restart, logging out will not work

Resources