Adding 3rd party libraries in CLI app - Swift - ios

I have a CLI app made in swift through Xcode 7.3 beta 2 and Swift 2.2. I'm trying to add a library in my app called OAuthSwift by manually copying it and adding it in my target.
Trying to run the app, I keep on getting this error:
dyld: Library not loaded: #rpath/libswiftAppKit.dylib
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/Vapor-bxotywnuvdhyupfqfmhdgtykiqlj/Build/Products/Debug/OAuthSwift.framework/Versions/A/OAuthSwift
Reason: image not found
Would any of you know how to get around this?

Related

No such module 'AppInvokeSDK'

Paytm All-in-one SDK integrated successfully and working fine in simulator but when I am trying to run in real device, its giving me an error that No such module 'AppInvokeSDK'
Cannot run in real device (iPhone 8)
Following error getting in log:
dyld: Library not loaded: #rpath/AppInvokeSDK.framework/AppInvokeSDK
Referenced from: /private/var/containers/Bundle/Application/840EAA6B-AB7E-4712-B77F-B6E625E899D2/app.app/app
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
here is the screenshot:
I got to know later, By mistake I put framework in somewhere else. Actual place for external framework is inside the "Framework" folder in Xcode.

Proper way of embedding dylib into an iOS app

I have a project which consist of three elements:
C source code that is compiled to .dylib
Swift framework used to provide user-friendly swift API for .dylib
iOS app consuming both .dylib and swift proxy
I have added both swift proxy and .dylib as "Framework and libraries" dependency to iOS app project. Things work as expected on my iPhone. However when I attemt to send my app to Apple Store Connect I get following error:
ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftDispatch.dylib, libswiftCoreGraphics.dylib, libswiftCoreFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftObjectiveC.dylib aren’t at the expected location /Payload/Runner.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.
I figured this can be caused by .dylib file being embedded directly in iOS app, so I tried to embed .dylib into swift framework. Then I made iOS app embedding only swift framework, which consist of .dylib file. However I am getting following error in this configuration:
dyld: Library not loaded: #rpath/libX.dylib
Referenced from: /private/var/containers/Bundle/Application/.../swiftProxy.framework/swiftProxy
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib: code signature in (/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
This doesn't make sense for me, but I figured this is not the right way.
So the question is: how do I properly embed dylib so that it can be put on Apple Store Connect and then on Testflight?
I'm aware that this question was asked at least once, but there is no decent answer. Here for example: How to properly embed 3rd party .dylib files in iOS app project for App Store release?
Thank you

dyld: Library not loaded zendesk

On adding Zendesk to a project in my app, the app compiles fine, but on launching it, the app crashes with the following error:
dyld: Library not loaded: #rpath/ZendeskCoreSDK.framework/ZendeskCoreSDK
Referenced from: /var/containers/Bundle/Application/54F97442-93B5-469E-A069-5F91C4689249/App.app/App
Reason: image not found
I am quite sure I have followed all the instructions, but this just refuses to work
:)
In your project, goto build phases and the embedded frameworks section, find the 3 Zendesk frameworks in the file list and drag them into this section.
it will work now. :)

Implement AdobeCreativeSDK in an iOS project - can't validate archive

I need to implement Aviary photo editing in my iOS project. For that you need to add the AdobeCreativeSDKCore.framework and AdobeCreativeSDKImage.framework. I tried following their guide here and I also tried via cocoapods.
Adding the frameworks manually
When I add the frameworks manually, everything works fine, but when I try to validate the archive or upload it to testflight I get many errors. I get this as long as the frameworks are imported no matter if I try to use them in code or not. You can see the errors in this screenshot:
Using Cocoapods
I add the 2 pods, install and then add the "strip frameworks" script provided in the frameworks (as per Adobe's instructions). Like this I can archive, validate and upload without a problem, but when I use them in code and run the app it crashes on launch with the following error:
dyld: Library not loaded: #rpath/AdobeCreativeSDKCore.framework/AdobeCreativeSDKCore
Referenced from: /Users/rado/Library/Developer/CoreSimulator/Devices/13E81DE6-83DE-4ABC-9AEE-C498D25D8F2C/data/Containers/Bundle/Application/829ACA06-8150-4745-82F7-1ED4F86884E7/CrowdGraf.app/CrowdGraf
Reason: image not found
(lldb)
I'm stuck on this for over a week now. Any ideas how to fix this?

iOS dyld: Library not loaded: /usr/lib/libc++.1.dylib

The iOS application i'm creating uses ZXing, Couchbase and Couchcocoa. Originally I only needed libc++.dylib and I can run the program using the Simulator.
When I tried running on the device, it builds successfully but then crashes and I get the log:
dyld: Library not loaded: /usr/lib/libc++.1.dylib
Referenced from: /var/mobile/Applications/E6AD6AC4-4081-4608-86FB-306D86DCFD35/qrcard.app/qrcard
Reason: image not found
I then added libc++.1.dylib in the link binary libraries. And I still get the same logs.
Have you tried just renaming your main.m to main.mm? That will tell Xcode to link against C++ dependences itself. I'm wondering if there are load path flags you have to give the build if you try to explicitly name C++ libraries (which isn't even all that well defined in Xcode anymore since Apple now provides multiple versions of at least some of the C++ libraries.)
It may not be the only way, just the only one I've used. But I've never gotten an error with this method.

Resources