Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on app start on iOS 11 & 12 (Xcode 11.4.1 / KlarnaMobileSDK 2.0.20) #20

Closed
tp opened this issue Oct 21, 2020 · 2 comments
Closed

Comments

@tp
Copy link

tp commented Oct 21, 2020

Describe the bug

After adding this SDK (165fd67), we observed crashes on iOS 11 and <= 12.1:

image

We could also reproduce this ourselves on iOS 11.4.1 with the store version of our app. Upon excluding the Klarna SDK from the app again, the app started without issue on device. (iOS Simulator 11.41. is similarly broken, but I hoped it might be related to just that architecture not being supported by the package.)

We're on Xcode 11.4.1, so we can't yet use the latest underlying SDK version

To Reproduce
This can also be seen with the Klarna sample project (when using the latest version which is compatible with our Xcode version).

Steps to reproduce the behavior:

  1. Clone https://github.com/klarna/kp-ios-example-app
  2. Edit the Podfile to use pod "KlarnaMobileSDK/xcode-11.4.1-fat-full", '= 2.0.20'
  3. Run on iOS 11.4.1 Simulator (couldn't test on device, as I don't have physical access to it)

Crashes on start, with message

dyld: Library not loaded: @rpath/libswiftos.dylib
  Referenced from: /Users/timm/Library/Developer/CoreSimulator/Devices/73E1D4B2-F725-4E8D-8ECB-D82BFCAF7765/data/Containers/Bundle/Application/86A43189-5CD3-4DAD-8443-F2CF3AE35CD4/FashionStore-CocoaPods.app/Frameworks/KlarnaMobileSDK.framework/KlarnaMobileSDK
  Reason: no suitable image found.  Did find:
	/usr/lib/swift/libswiftos.dylib: mach-o, but not built for iOS simulator
	/usr/lib/swift/libswiftos.dylib: mach-o, but not built for iOS simulator
(lldb) 

I am just wondering whether this error on the simulator (which should be supported), is also happening on device 🤔

Expected behavior
App starts.

Device and version:

  • Device: iPhone SE / iPad mini
  • OS version: iOS 11.4.1 (we see 11.0.0 up to including 12.1.0 in the server-side logs)
  • Klarna In-App SDK version 165fd67

(This is the same issue I sent you via mail, but I guess it makes sense to share the issue and solution for future users as well.)

@polar133
Copy link
Contributor

Hi @tp this issue is happening because our SDK doesn't contain the standard swift libraries included.

To fix it we need that the swift libraries for each arch (in this case, sim) be available in the project.

Workaround: change "Always Embed Swift Standard Libraries" to YES in the Build Settings of the target project.

If that doesn't work. As suggested, add these lines in any .swift file:

import os

let osLog = OSLog(subsystem: “Test”, category: “Test”)
os_log(“Test message”, log: osLog, type: .debug)

That should be able to add the os framework into the project and our SDK can recognise it.

Also we updated the Flutter SDK so we add the import into our files. Please, give a try and let us know how did it go.

@tp
Copy link
Author

tp commented Oct 22, 2020

Hey @polar133,

thanks a lot for figuring out the OSLog workaround and including it so quickly (the Swift lib embedding was already set, but didn't have the desired effect).

We have pinned the your Flutter SDK for revision bf47230 and successfully tested it on an affected device 👍

So we can close this one. Thanks again!

@tp tp closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants