1

Just finished updating codebase to Swift 4. It is working fine in the simulator. When I build to a device I get an instant crash with no error message:

enter image description here enter image description here enter image description here

It works fine in the simulator.

There are some threads on it:

App crashes only with (lldb)?

iOS app crashes with no error, just (lldb)

dyld`__abort_with_payload: With no error message

From what I learned the problem might be linked binaries but I've dug into my linked binaries and I believe everything is linked correctly.

Any thoughts on where to begin debugging this or what the problem might be?

Update1: I had an internal framework for one of my xcodeproj's so I tried removing it and installing it as a pod but the error still persists.

Update2 Adding full stack trace: enter image description here

Update3 Error trace from forcing crash by launching app not from Xcode but the phone itself and then tracing error log: Termination Description: DYLD, Library not loaded: @rpath/PromiseKit.framework/PromiseKit | Referenced from: /var/containers/Bundle/Application/C50A937F-2A6F-4E5C-89C7-2D

Update4 After removing the promisekit framework the shell version of the app does compile on the device which leads me to conclude this (like the others who have had this mysterious issue) is a framework link error. However trying all the solutions in the common threads like:

iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

Has not worked. Embedding and linking or anything else has not worked.

So it is a framework linking error of some kind but linking and embedding does not seem to fix the issue.

Aggressor
  • 13,323
  • 24
  • 103
  • 182
  • Are there any messages in the *device* console log that might give a clue? Have you looked in the Frameworks folder inside the app package itself to see if everything you expect is there? – Phillip Mills Oct 25 '17 at 15:29
  • @PhillipMills I had dug into that and sadly it's clean. There is no crash log. All the happens is the app launches with the splash screen and freezes. – Aggressor Oct 25 '17 at 15:37
  • (Just to be clear, I didn't mean crash log...I meant the log that shows at the bottom of Xcode's "Devices" window when the device is selected.) – Phillip Mills Oct 25 '17 at 15:41
  • @PhillipMills I just checked now several times, nothing new is added to the phone log each time I try to launch the app. – Aggressor Oct 25 '17 at 15:47
  • It might be helpful to expand the thread display to see layers 1 through 4. That may provide a clue which condition failed in the DYLD code. – Walt Sellers Oct 25 '17 at 16:01
  • @WaltSellers Could you clarify what you mean "expand thread display to see layers 1 through 4" – Aggressor Oct 25 '17 at 16:02
  • The dotted line indicates that Xcode has skipped showing the intermediate layers of the stack. You can see layer 0 and layer 5, but not layers 1 through 4. Use Xcode's controls at the bottom of the frame to make it show all the layers. Or type the LLDB commands in the console frame to make it list them: "thread backtrace" or "thread backtrace -all" – Walt Sellers Oct 25 '17 at 16:10
  • @WaltSellers I've added the full stack trace – Aggressor Oct 25 '17 at 16:17
  • abort_with_payload should in the normal course of things pass the abort reason (stored in the payload) to the kernel and that should get logged. But when you stop in the debugger, and then kill the process, lldb just kills it at this point so the abort doesn't continue on and pass the abort reason to the kernel for logging. So if you haven't done this yet, try finger-launching the app instead of running it in the debugger. Presumably that will also crash, but it should leave some log information in the device console. – Jim Ingham Oct 25 '17 at 18:56
  • It has illuded to what I have been suspecting is the issue a framework not loaded. I've added the error log and I've been trying to link the framework differently but nothing seems to work yet (using embedded, and linked, or a custom build .framework etc). – Aggressor Oct 25 '17 at 19:16

3 Answers3

0

One of the things that can trip up development with the simulator is its access to Macintosh resources. The project may have accidentally been linked to a Macintosh version of a framework or library. It exists on the simulator, but does not exist on an iPhone device.

I have had issues in the past with Xcode choosing the wrong version of a framework when the targets for iOS and Mac had the same names. If you have such frameworks, try changing one or both target names and product names temporarily. Then see if Xcode is choosing the one you intended.

Walt Sellers
  • 3,806
  • 30
  • 35
0

The long and the short of it was when I embedded the framework into the main app, it caused some other obscure bug. When I removed a runscript from the build phases, it allowed the embedding to actually work and it fixed the issue.

So by deleting the run script phase seen below in the build phases: enter image description here

I was able to embed the framework and the app began to compile on devices.

So if you have this type of error in the future the solution is still to embed it, but in my case, there was another problem preventing that embedding from working.

Aggressor
  • 13,323
  • 24
  • 103
  • 182
0

After I solved another problem: https://stackoverflow.com/a/48538124/1012775 I modified some settings that kind of messed up my build settings. Because of that I got the same problem as the questioner here.

I solved it by doing a 'git reset --hard' and got back to my clean state. Since than I don't have this issue anymore, thank God. It might work for you too.

AndaluZ
  • 1,410
  • 3
  • 15
  • 33