Gameplay Crashes From ipa file but runs fine from Xcode? - ios

It is somewhat an awkward situation right now.
When I run my project directly from Xcode to my device it runs perfect without any crashs. But when I create an ipa file of that project and install that ipa into my device by using iTunes, only for the first time when I launch my gameplay screen it crashes, later on when I starts my gameplay it runs fine.
Remember, my gameplay starts after the user navigates 2 initial screens which works pretty fine in either conditions. (i.e running from Xcode or from ipa file).
What I dont understand is that if the problem is in my init method of the gameplay class why it does not crashes when I run it directly from Xcode. Is there any code compression or different mechanism of code compilation when running as an ipa or from Xcode.
Any help would be appreciated.
Thanks

I faced the same scenario, the ipa file was crashing after two initial screens. The crashlog did give the line of crash in the code. Debugging the code did not solve the purpose.
But I solved the issue by checking the Archive settings in the Edit Scheme section.
My Build was in Debug mode and the Archive setting was Release, I changed the Archive's build configuration to Debug and created an ipa and the crash was resolved.
Hope this helps someone save productive time. Thanks.

As adig said, get crashlog from device, then symbolicate it. You will see call stack and the line, that caused crash. All differences between release, debug, ad hoc, etc. build configuration you can setup in your project.

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.

App is NOT Crashing While Debugging

I am facing a strange issue in my currently working app. App is crashing when we install app through diawi or directly install using .ipa . But I am not able to regenerate the issue through debugging. I am totally confused and how can I solve the issue?
I am using Xcode 8.2.1
You can try building the app in Xcode in the Release configuration instead of the Debug configuration.
You do this by
clicking on your app name at the top left (near where you press to run the app)
choosing 'Edit Scheme' from the drop down
clicking on the disclosure indicator by 'Run'
choosing 'Run' from the three choices which appear
there is a drop down called 'Build Configuration'. This will almost certainly be set to Debug. Set this to Release.
Now when you run your app you will be building a far more optimised version - this is the version you build when you are submitting to Apple. It's just the same app optimised for speed/memory instead of debugability.
Hopefully, you should be able to reproduce your crash in Xcode now. However, you'll notice that you get far less debugging information when you hit your crash - this is because Debug builds have lots of extra information in (and are much less optimised by the compiler) specifically to make debugging easier. Being able to reproduce the crash in Xcode should give you a few more clues as to what's going on. At the least you should be able to see the chunk of code causing you issues.
Let us know how you get on.
Use crash tracking tool to track crash here is the detail about installing crashlytics

Bitcode Compile During Archive Never Finishes

I am preparing an app for ad hoc distribution via Test Flight. I have stepped through (successfully) all of the preparatory steps in this Ray Wenderlich article already (https://www.raywenderlich.com/48750/testflight-sdk-tutorial), and I feel confident that the certificate, App ID, and Provisioning Profile are all created correctly and in proper working order. I am on the step in which you archive the project in Xcode. I have selected these settings during the archive process:
I choose to Export :
I choose "Save for Ad Hoc deployment" since our plan is to use Test Flight to distribute the app to our testers. I do believe this is the correct option for that (as opposed to "for enterprise deployment"):
This is the default setting, and I do not have a specific reason to change it, although I'd appreciate any insight you may have:
Again, default options for both of these. The first one is unchecked by default and the second one is checked by default:
When I get to this screen, the spinner spins seemingly forever:
The problem seems to be that once it gets to the part where it is compiling from bitcode it spins and spins and shows no signs of finishing. When I am building the app to run on a device connected to the MBP, it compiles quickly, usually within a few seconds. What could be causing this unresponsiveness?
I am facing the same problem. What my suggestion is just enable this check mark when export for iOS App Store Deployment. If you are exporting an adhoc build then do uncheck it. It will work fast.
I have better solution for this problem. Don't go for export option tomato iPA, try out as mentioned below:
just right click your Archive and select show in finder
Then again right click on resulted file in finder and select show package content
then from result open product folder --> Application folder --> and select ".app" file
Then simply add this .app file under apps of iTunes software on mac
After completing adding process right click on app icon in iTunes
and show in finder which will give you iPA file.
It would take only 5 minutes max.
I let this run for a long time (basically while I went out shopping). When I came back it was done. So for whatever reason this just takes a really long time to do.
That said, it was also the incorrect action. The way you add testers to TestFlight since Apple bought it is different. Now, instead of exporting and uploading an IPA file, you have to submit it to the store and let it be reviewed by Apple before you can add testers.
One more option is, You have to keep eye on which source code you have is taking small time and get archive process done quickly. So from next time you will have to open this particular source code and perform archive, after that open your working source code and then try archive for that. You will get that done fast for working code as well.
For me, I have kept 2 source code separately.
One for Xcode 7
Other for Xcode 8
So whenever I want to create ipa, I open this source code first and make archive then I close this code and perform archive for code I am currently working. This is bit lengthy process but surly it don't take that much of time as well as your system don't get hang.
You can disconnect your wifi wait a few minutes to reconnect again, and then it is ok

app with Objective-C and swift code crash at launch in release mode, debug mode fine

My project is Objective-C based, and have some third party swift code.
The app runs fine at debug mode, however, when I archive the app as release mode, the app will crash at launch screen.
Set swift optimization level to None still has the same issue. I have crashlytics 3.7 installed, but it crashes at launch, it didn't have a chance to upload the crash. I am very desperate. Any ideas?
Update:
I tried to remove all swift stuff and archive, everything is as usual now. However, once I drag the swift files into my Objective-C based project, Run(debug) the app is fine. But if archive(release) and install it on iPhone, immediate crash at launch. Anything what I am missing?
Alright, after thousands of archiving and testing, I found it's being caused by the in-house distribution.
It is mssing one attribute 'OU' in the certificate. I had to re-create a new cert, and now it has 'OU' there. Looks like Apple does not mention it at all when dealing with old projects adopting swift code.
Quote from Enterprise Distribution not playing nice with iOS8 in Swift App
All explained in details in this article :
https://www.airsignapp.com/ios-apps-using-swift-crash-when-signed-with-inhouse-certificate/
We can confirm that after create a new cert and .mobileprovision, no more issues.
We found origins that caused this issue, related to a missing attribute in “Subject” field InHouse Certificates :
BEFORE Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, O=Company Name, C=FR
AFTER Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR
I'll post this is an answer, because I don't have the rep to post comments. I've had similar problem, although not related to Swift. Could be worth checking out though.
For me the problem had to do with file deletion in Xcode. I had removed some files from the Xcode project, but they were still present in the folder on my hard drive. When running the project through Xcode it would load these files as if they were part of the project, but when archiving it would not include them. This made the app work perfectly when run through Xcode, but crash when running the archived version, as it tried to load something that didn't exist.
So, one thing to check is that the files that should be loaded when starting the app are visible in the project navigator in Xcode. Hope it can be of help!

Routing app coverage file not copied to the simulator

Since updating to Xcode 6, I see this warning every time I run the app on the simulator. My app has a routing app coverage file and I want it copied to the simulator but it's not happening. This seems like it might be a bug. Is there a workaround?
I had a similar error some time back, because XCode may be using a precompiled version of the app.
This is how I solved it:
In xCode, make sure that your app isn't running in the simulator (click the stop button), then
Build menu > Clean target or SHIFT-CMD-K.
Additionally, clean the content in the Derived Data folder ~/Library/Developer/Xcode/DerivedData/.
Hope it works for you.

Resources