App works when using ad-hoc deployment, but crashes when using TestFlight

I have build an iOS app(my first). When I use the Ad-Hoc iOS Device Deployment for Testing, the app works fine.
If I build the app for the app-store and use TestFlight, the app crashes directly on opening.

I tried serveral changes without any result, the app crashes on opening.

The crashlog doesn’t help me. Can anyone help me to solve this problem?

Crashlog:
Incident Identifier: 143EF07C-B366-41C9-BAB0-4385802D367A
CrashReporter Key: 8a84833a074cfd1c7d987a88f7e9fe78d79aa869
Hardware Model: iPad5,4
Process: TestFlight [2953]
Path: /private/var/containers/Bundle/Application/A05C3345-88EC-4150-9533-4FAF59F30945/TestFlight.app/TestFlight
Identifier: com.apple.TestFlight
Version: 81 (2.0.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.apple.TestFlight [1354]

Date/Time: 2017-12-29 09:17:09.1146 +0100
Launch Time: 2017-12-29 09:16:46.2321 +0100
OS Version: iPhone OS 11.2.1 (15C153)
Baseband Version: 6.30.04
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
(0x183856364 0x182a9c528 0x1838562ac 0x18cf5c67c 0x18d4bda9c 0x182a9aef4 0x182aa8638 0x182aa8690 0x18d4ab2bc 0x182a9aef4 0x182aa8638 0x182aa8690 0x18d0f7e4c 0x18cea3934 0x1837201b4 0x18cfa5c80 0x18cf98ef0 0x18cd2a54c 0x1837fdedc 0x1837fb894 0x1837fbe50 0x18371be58 0x1855c8f84 0x18cd9b67c 0x1010472a4 0x18323856c)

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001833682e8 0x183346000 + 140008
1 libsystem_pthread.dylib 0x000000018347d2f8 0x18347a000 + 13048
2 libsystem_c.dylib 0x00000001832d6fbc 0x183274000 + 405436
3 libc++abi.dylib 0x0000000182a73068 0x182a71000 + 8296
4 libc++abi.dylib 0x0000000182a73210 0x182a71000 + 8720
5 libobjc.A.dylib 0x0000000182a9c810 0x182a94000 + 34832
6 libc++abi.dylib 0x0000000182a8b54c 0x182a71000 + 107852
7 libc++abi.dylib 0x0000000182a8b158 0x182a71000 + 106840
8 libobjc.A.dylib 0x0000000182a9c6e8 0x182a94000 + 34536
9 CoreFoundation 0x000000018371bec4 0x183710000 + 48836
10 GraphicsServices 0x00000001855c8f84 0x1855be000 + 44932
11 UIKit 0x000000018cd9b67c 0x18cd28000 + 472700
12 TestFlight 0x00000001010472a4 0x100f9c000 + 701092
13 libdyld.dylib 0x000000018323856c 0x183237000 + 5484

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x00000001c42e3737
x4: 0x0000000182a90afd x5: 0x000000016ee634d0 x6: 0x000000000000006e x7: 0xffffffffffffffeb
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x00000001834815e0 x11: 0x0000000000000003
x12: 0xffffffffffffffff x13: 0x0000000000000001 x14: 0x00000001832ed53f x15: 0x0000000000000010
x16: 0x0000000000000148 x17: 0x00000000ffffffff x18: 0xfffffff00969925c x19: 0x0000000000000006
x20: 0x00000001b45a7b80 x21: 0x000000016ee634d0 x22: 0x0000000000000303 x23: 0x00000001b45a7c60
x24: 0x00000001c4000960 x25: 0x0000000000000000 x26: 0x0000000000000001 x27: 0x0000000000000000
x28: 0x000000016ee63b30 fp: 0x000000016ee63430 lr: 0x000000018347d2f8
sp: 0x000000016ee63400 pc: 0x00000001833682e8 cpsr: 0x00000000

Have you tried watching the log to see what was happening leading up to the crash? iOSConsole will let you do that:

http://lemonjar.com/iosconsole/

Greg, sorry for the late response.

With iOSConsole I saw error/failure messages, but did not find a working solution.

Several times I saw that the problem might be in xcode. So I have upgraded xcode from 8.3.2 to 9.2 (and also macOS to High Sierra 10.13.2).
Now I have another problem. Ad-Hoc deployment works fine, but building the app for submitting to the appstore goes wrong.

While building the app, this error message appears:

he operation couldn’t be completed. 2018-01-09 14:35:15.390 xcodebuild[1567:301101] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path ‘/var/folders/w4/7bhmtt2d1mq1y3j_bbzqgrc80000gn/T/hkv_ios_2018-01-09_14-35-15.389.xcdistributionlogs’.
2018-01-09 14:35:15.490 xcodebuild[1567:301101] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fe9d6b0b6e0>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 “Locating signing assets failed.” UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
“Error Domain=IDEProvisioningErrorDomain Code=9 ““hkv_ios.app” requires a provisioning profile.” UserInfo={NSLocalizedDescription=“hkv_ios.app” requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the “provisioningProfiles” dictionary in your Export Options property list.}”
)}
error: exportArchive: “hkv_ios.app” requires a provisioning profile.

Error Domain=IDEProvisioningErrorDomain Code=9 ““hkv_ios.app” requires a provisioning profile.” UserInfo={NSLocalizedDescription=“hkv_ios.app” requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the “provisioningProfiles” dictionary in your Export Options property list.}

Removing all provisioning profiles and recreate them did not help.

What can I do fix this?

Install XCode 8 beside 9 and use 8 for Xojo Builds and wait for Xojo to support XCode 9. :slight_smile:

I’m using 2017r3 and Xcode 9.2 : see this conversation

Sascha’s advice is correct. You can’t build for the App Store (required in order to ship a Testflight build) with 2017r3 and Xcode 9. (https://xojo.com/issue/50759)>]Please see here. You will need to install Xcode 8.

@Sascha and @Jason: yes you were both right. After Installing Xcode 8 I could ‘Build for App Store’ again. Thanx!

Back to the first problem, the app still crashes on opening after installing from TestFlight.

Does the app run in the simulator on the same device type that you are using for the TestFlight build? If so, have you tried deleting the app from the simulator so that the app sandbox is recreated the next time you run the app, just in case there’s something missing from the bundle that you expect to be there? If that doesn’t help, I’d be adding some debug logging to try to work out where the app is crashing.

@Jason Tait , thanks for your help!

The App runs in the simulator and via the Ad-Hoc iOS Device Deployment without any problem.
The simulator device: iPad Air 2(iOS 10.3 and 11.2). Test device iPad Air 2 (iOS 11.2.2).

I will check if nothing is missing in the bundle. If not, I add debug logging.

Below the link to the logging on the iOSConsole when the app runs for the first time. Suggestions what is wrong or missing?
iOSConsole logging

Solved it. Very stupid mistake…

The app is using a Sqlite database. The problem was the Copy Files Build Step set up. In the Navigator Build settings, the Copy Files was below the Sign and not between Build and Sign.

The app does not crash anymore on start up :slight_smile:

Good news Rob. That’s what I meant by “…in case there’s something missing from the bundle that you expect to be there”. It seems to be a fairly common mistake based on previous threads.