iOS crash on Launch with Distribution package

I am currently using 4.12 with both an iPod Touch and an iPhone 6S Plus, both of which are running iOS 9.3.2. I am working on a plugin and we are using the QAGame example as our testbed app.

When I use the launch option, I am able to run my app just fine and the plugin works as intended. When I package the app for distribution and then install it onto the devices using iTunes, it will start, flash the splash screen, then crash. Here is a crash log from the crash.link text

So I packaged it for shipping and it still crashes. Here is the last part of the launcher log where it packages it.link text

Hello Kim,

If you wish to install your application through iTunes, you’ll need to package your project for Shipping. Distribution will only work if the application is installed through the App Store. If your project continues to have issues in shipping, please let me know and we can continue investigating.

I apologize, I should’ve been more detailed in my original response. I didn’t fully understand it myself, but I do now so at least we’re both learning.

When packaging for iOS, the packages have to be signed with either a Distro (Distribution) provision or a Shipping/Developer provision. A Distro provision would be used to sign the package when you wish to push it to the App Store while the Developer provision would be used when you wish to install it directly as you are.

From looking at the logs it’s currently signing it with the Distro license which can be seen on this line:

IPhonePackager: Using mobile provision ‘AllMerc_QAGame_Distro’ to code sign

Please make sure you have a Developer provision in your iOS settings under Edit > Project Settings and then also ensure that “For Distribution” isn’t checked under the Packaging section of Project Settings. This should allow for it to be signed for Development, allowing you to use the package the way that you’re attempting to.

Using this packaging command, it still crashes with exactly the same crash log:
C:\UE4\Engine\Binaries\DotNET\IOS\IPhonePackager.exe RepackageFromStage “C:\UE4\QAGame\QAGame.uproject” -config Shipping -schemename QAGame -schemeconfig “Shipping” -compress=best -sign -stagedir “C:\UE4\QAGame\Saved\StagedBuilds\IOS” -project “C:\UE4\QAGame\QAGame.uproject” -provision “MercenaryApp_AllMerc.mobileprovision” -certificate

Just to be sure, do the packaging logs indicate that your developer provisions are being used? Also, has the device that you’re installing to been added to that developer provision?

When launching on vs packaging, the process is quite a bit different but both do generate .ipa files which can be installed. Since launching on is working for you, would you be able to test installing the .ipa generated by that directly?

Something else we can test to try to narrow down the problem is packaging for shipping and then installing from a blank project. We’ve had reports of crashing from the splash screen that were related to content issues so this could let us know if it’s something to do with QAGame or the plugin if this works correctly.

Yes, it is using the developer certificate and provision in this case. I have tried to install the .ipa generated by the launch process directly. It also crashes in that case. Since the crash log is ALWAYS inside the UIKit and I have made no changes to the UI at all for the project, it seems very much to be an asset issue to me. I feel the most likely answer is that somehow the bundle is not being loaded correctly so that any attempts to pull files out cause it to crash. The one case that works uses the -iterate flag which puts the assets into the documents folder instead of using them from the bundle.

From the log:
IPhonePackager: Executing iPhonePackager RepackageFromStage C:\UE4\QAGame\QAGame.uproject -config Shipping -schemename QAGame -schemeconfig Shipping -compress=best -sign -stagedir C:\UE4\QAGame\Saved\StagedBuilds\IOS -project C:\UE4\QAGame\QAGame.uproject -provision MercenaryApp_AllMerc.mobileprovision -certificate iPhone Developer: Kimberly Power (********)

I have also built a version that does not call any of the plugin code at all and it still crashes in exactly the same way.

So I built the Blank Project for iOS. When I launched it, it worked fine on my device. When I attempted to build a package to install using iTunes, it crashes in the same way that QAGame does. At this point I am forced to conclude there is either some configuration option I am missing, or that iOS packaging is somehow broken.

Thank you for testing that, at least now we know it’s not content related. Could you upload a copy of your full cook log for either your old project or the new blank one?

So here are logs from packaging both QAGame (with our plugin) and the Blank project. The ones that say launch or launcher both run. The Blank project one is missing some assets, but it manages to run anyways. QAGame_launch runs without any warnings.

Both versions that say package in their name, crash.

link text

Thank you for that, unfortunately it isn’t giving all of the information we need. I apologize for the back-and-forth here. There is a way to get more however. Please hook your device up to your Mac, open Xcode and then go to Windows → Devices and select the iOS device. Expand the window at the bottom and then run the app. The blank one would be best since it’s packed for Dev, should give us better logs. After it finishes, you can use the download symbol at the bottom right of the window to save the logs.

If for any reason you can’t get the logs, you could also send the .ipa itself and I should be able to get the necessary logs.

link text
Here is a crash log from the device.

One thing I realize we are doing that is not standard in packaging is that were building the paks in chunks (not the HTTP chunks). In the case of both apps there is so little data that it only builds one pak file anyways. Since I see a reference to chunk1 in the crash, that may be part of the issue.

No I don’t. Should I? I am not really using any of the services so I didn’t enable them.

Do you have Push Notifications enabled for your iOS App ID on your cert on the apple side of things? Example of what I mean:

From looking at the logs, it seems that the app is crashing when trying to send an iOS alert to an object that it isn’t allowed to. Enabling those push notifications may help and could avoid the crash.

link text
Here is the crash with push notifications on. It also is only possible to turn on push notifications in an App ID that explicitly names the bundle (no wildcard). The UE4 documentation even suggests using a wildcard in your App ID, so Push Notifications really shouldn’t be required for the apps to work.

Also when I looked up the particular error message, it seemed it happened to most people when a UI element was missing or not provided. In some cases it was bad code that didn’t pass along the sending object, in other cases the UI element (or the whole UI) disappeared before the message was handled causing the crash. Since I have done absolutely nothing with the UI, it shouldn’t be an issue I caused. It is noticeable that the issue also only happens when the app is trying to use resources from the bundle instead of the documents folder.

I just managed to narrow the issue down to the generate chunks option in packaging. When I check “Use Pak File” but not “Generate Chunks”, it works fine. If I check “Generate Chunks” it then crashes. I am fairly confident the following from the crash log is why. Keep in mind that it only generates a single chunk for these apps since the amount of data is currently so small.

Jun 28 13:55:59 Kimberlys-iPod-touch ondemandd[158] : Invalid tag in set [{(
Chunk1
)}] for BundleURL: file:///var/containers/Bundle/Application/62A37040-5B19-4A31-8504-A633711E418E/QAGame.app/. Nothing will be pinned.
Jun 28 13:55:59 Kimberlys-iPod-touch ondemandd[158] : Invalid tag in set [{(
Chunk0
)}] for BundleURL: file:///var/containers/Bundle/Application/62A37040-5B19-4A31-8504-A633711E418E/QAGame.app/. Nothing will be pinned.
Jun 28 13:55:59 Kimberlys-iPod-touch com.apple.xpc.launchd[1]

I also had to add this

<key>UIBackgroundModes</key>
<array>
	<string>remote-notification</string>
</array>

to my additional plist info to make the warning go away. Since I am not using any remote notifications this requirement is coming from the engine and should probably be automatically added to the plist file in cases where it is being used by the build process.

Thank you for that information, I’m currently working on trying to reproduce the issue locally with the new specifics that you provided.