Xcode Swift: Error using a framework that uses a pod (CocoaPods) - ios

I have made a Swift framework that uses a pod (SCrypto). I could build the framework and the host project with no errors.
But when I run the iPhone simulator (from the project that uses the framework) I get the following error:
dyld: Library not loaded: #rpath/SCrypto.framework/SCrypto
Referenced from: ...
Reason: image not found
I'd be very thankful if someone helped me with this problem.
Details:
Have tried clean and build, didn't work.
Both the project and the framework are in Swift, meant for iOS. I'm using the latest versions of Swift and Xcode.
My pod file includes use_frameworks!. I have not run 'pot init' in the directory of my project - just in the directory of the framework.
In the build phases of the project, the framework is listed under Link Binary with Libraries.
There are some other pages on stack overflow about this error, but the solutions there are outdated or didn't work for me. It doesn't let me comment on those (to say that it didn't work for me). Some of the other ones seem to complicated for a simple thing (using a framework that uses a pod), which make me doubt if they would work. Again, I can't comment there and ask this. So I have to use this page instead.

You need to run pod init in the directory of your project so that when you run pod install it will install it to your project, then close everything after installation and open again your project , only this time use yourprojectname.xcsworkspace. be sure it's not yourprojectname.xcodeproject or it will give you No such module error

Related

'FBSDKShareKit/FBSDKShareKit.h' file not found

I've made an IOS build on Unity for an App we're making after adding the facebook SDK, moved the build on a hard drive and tried to build it on xcode on the mac we have at the office, as I always do before uploading it to the app store. I ran into this error and I've been stuck on this issue for 2 full work days and it's driving me a bit crazy, here are the thing's I've tried:
-Install cocoapods, both on the default terminal directory and on the project's directory (I'm not too experienced with cocoapods so I don't know if that made a difference. I also did pod update while standing on the project directory).
-I saw that the IOS resolver has an option called "generate pod files" that people said needed to be checked when building to solve this issue. It was checked by default on my project, so that wasn't it.
-Added the framework path on the build settings to where the facebook SDK is at (though the way it looked on my xcode seemed a bit different than the way I've seen it on other people's xcode screenshots)
-Tried commenting out some #include lines on the headers that are generating the issue. It only produced more errors.
-People said to open the project from the workspace instead of the xcodeproject but unity doesn't seem to generate a workspace file.
-Tried downgrading the Facebook SDK to a previous version but the versions people claim are working don't seem to be on the repository anymore, so it doesn't let me downgrade to them.
At the moment I'm trying to make it work with the latest Facebook SDK which is 9.0.0.
Any help would be appreciated, please let me know if I'm not being specific enough about the issue or if there's any information about my project I should include on the post
The .xcworkspace should be created by Cocoapods, not by Unity directly.
If you already have the Podfile generated, just run pod install on the project directory and open the created .xcworkspace file after Cocoapods finishes installing the external dependencies.

Xcode showing error 'No such module' even though I've installed Cocoapods and installed pod file of Dialogflow

I've been making a chatbot using Dialogflow formerly Api.AI but now encountering error while integrating the project to my app written in Swift in Xcode. I'd installed cocoapods using terminal "sudo gem install cocoapods" and using this version of Dialogflow to create the podfile.
All gone well but now when I'm importing inside Xcode in my app's AppDelegate.swift file using import ApiAI or import AI Xcode is showing me error that No such module. Please refer to image.
And on GitHub this library which is written in Swift, showing that it has depreciated and asking me to refer to API.AI's Apple Client library which is in Obj-C and unfortunately I've no expertise in Obj-C.
After installing a pod using Cocoa Pods, you must from that point forward open the workspace rather that the project file. The icons will appear differently in your project like so:
In the image you provided is clearly showing that you have opened the project file not the workspace one.
Go to Pods Build settings and set Build Active Architecture Only to NO. This always helps while using pods. After that clean the project once and then build.
After installing pod you should clean project (shift + command + k) and then builds (command + b) in it a few times. Repeat it a few times if it is not still working.
Hope this help!

CocoaPods not working on framework target

Im building a IOS app that uses a third-party library.
The library project is inherited from another developer that im unable to ask anything.
It is configured to use CocoaPods to manage dependencies, it has a lot of them.
When i run "pod install" it downloads all of them and creates the workspace.
In the workspace i have set the app target as dependent from the framework project product
Then i try to build it and it says it cannot find one of the dependencies of the framework project (it is on the podfile)
Then i found the framework project is missing "[CP] Embed Pods Frameworks" in build phases (the app project has it)
Also the "Pods_[targetName].framework" is shown in red (even when it indeed is in the build products folder, the path is correct)
I found this issue that seems to be exactly my problem but im unable to see if it has been fixed or not and what could i do to workaround this.
Same effect for me, my issue was the s.source_files in the podspec did not reference a location with actual files after a refactor.

Xcode 7.3.1 - Can't properly setup AWS

A year ago I had a project where I was using AWS. I forget exactly how it worked but it involved a BridgingHeader and no use of Frameworks.
I came back to this project today and none of the AWS stuff was working. I deleted all AWS/pod related files, got rid of the BridgingHeader reliance, cleaned the project, and proceeded to follow the pod-based instructions here:
http://docs.aws.amazon.com/mobile/sdkforios/developerguide/setup.html
However, the project still doesn't recognize any of the AWS libraries (getting the error "Use of unresolved identifier AWS...").
I saw a post by someone that suggested simply putting "import Framework" at the top of the files that use that Framework, but this doesn't work (it doesn't recognize AWSS3 when I put "import AWSS3", for example).
Then I saw advice that suggested figuring out the correct "Framework/Header/Library Search Paths" and so I created a brand new project, copied the podfile, and ran pod install. In this new project I am getting the error:
ld: warning: directory not found for option
'-F/Users/username/Library/Developer/Xcode/DerivedData/TestProj-gmhzshcpuyuvaffaocakhunyepaw/Build/Products/Debug-iphonesimulator/AWSAutoScaling'
for each of the AWS libraries.
When I go into the target build settings, I see that the Framework Search Paths have strings relating to the AWS libraries, but when I delete them I then get the error "ld: Framework not found AWSAutoScaling".
I tried giving the direct path to the respective folders but I get the same error.
I fixed the problem by opening the .xcworkspace file instead of the the .xcodeproj file.

PLCrashReporter frameworks integration produce "Could not inspect the application package." error

I am actually trying to integrate PLCrashReport using either a Framework (the one given on the official website) or Carthage.
Carthage won't compile the framework, and the manual drag & drop with the one downloaded from the website would produce the following error when installing the app on the device (Run build)
App installation failed
Could not inspect the application package.
I use a build target of iOS8, I linked the framework as an embedded binary to ship it with the app ; and this error is very annoying.
Xcode is in 7.3
Right now, I tried manual build for the framework, clean of the project. None would work.
By curiosity, I tried Cocoapod integration for this library, it worked, but Cocoapod is NOT an option on my project so I can't go with it.
Does anyone have had the same issue, any ideas for correcting it ?
Finally found a way to make it work :
PLCrashReporter should NOT be in embedded frameworks, just in linked frameworks. Works like a charm now, debug and release builds !

Resources