Support CocoaPod and Carthage - ios

I've created and published a Cocoapod using pod lib create. Now I also want to support Carthage, but after adding the path to the GitHub project to my Cartfile and running carthage update --platform iOS I'm getting the following error:
Dependency "" has no shared framework schemes for any of the platforms: iOS
Any idea how to fix this?

How it should work:
To add support for Carthage for your existing CocoaPods library you need to share the scheme of your CocoaPods project. To do that you have to:
Open the workspace that contains your pod (it should contain example and Pods projects).
Go to Product > Scheme > Manage Schemes.
Select the Shared checkbox for your pod scheme (scheme with the name of your library in Pods project).
Test if the scheme builds successfully by running carthage build --no-skip-current.
Possible problems
If you created your pod using pod lib create you might see that all schemes are already shared but carthage build --no-skip-current still fails with error message:
Dependency "" has no shared framework schemes for any of the platforms: iOS
This is because Xcode shows that the schemes are shared but the .xcodeproj/xcshareddata/xcschemes/YourProjectName.xcscheme file that marks the scheme as shared is missing. To fix this just uncheck and check the scheme sharing checkbox and the file should be created. Now you just need to commit and push the file to your repository.

Related

cocoapods depend on specific scheme

I have an old framework that can has a specific scheme that is shared so Carthage can build it. I want to use that scheme with Cocoapods. Is that possible?
As a side note, does pod spec lint build a specific scheme or does it basically try to run xcodebuild with the source_files you specify in the podspec?
pod spec lint and podspecs in general generate their own Xcode targets and schemes.
Typically, the podspec specifies the files and build information for libraries that get aggregated with an app's Xcode project to create an Xcode workspace.
So, as far as I know, the answer to your question is no.

iOS carthage with MQTT framework

I have a application which is written in objective c and using pods to set dependency and target iOS version is 7.0. Due to some license conflict i want to use MQTT with dynamic linking with help of Carthage. So I followed following steps
Remove pod 'MQTTClient' from pod file and run the pod update.
It removed MQTTClient and keep others pods intact like afnetworking etc.
then I create Cartfile in project directory.
Add Github "ckrey/MQTT-Client-Framework" in Cartfile.
Run command carthage bootstrap --no-build --platform "iOS"
then run carthage build --no-skip-current --platform "iOS" gives always error Skipped building project due to the error:
Dependency "project" has no shared framework schemes for any
of the platforms: iOS
I have following question
Q1 As I understand, we can use both Carthage and cocoapod in same project.
Q2 how to resolve error mention in step6.
You can use Cocoapods and Carthage in the same project.
On step #6 make sure you are specifying the download as a 'binary'

How to manually import third party Swift framework into Swift iOS project?

I am trying to import and use the OAuthSwift library in the Swift iOS project. I followed their directions:
Drag OAuthSwift.xcodeproj to your project in the Project Navigator.
Select your project and then your app target. Open the Build Phases panel.
Expand the Target Dependencies group, and add OAuthSwift framework.
import OAuthSwift whenever you want to use OAuthSwift.
After completing these steps, importing OAuthSwift using import OAuthSwift causes the error No such module 'OAuthSwift' and the project fails to build.
I have tried the following steps, based on a number of other SO questions about similar issues:
Clean and rebuild
Add the OAuthSwift framework to many different combinations of Build Phases > Target Dependencies, Build Phases > Link Binary With Libraries, Build Phases > Embed Frameworks, and General > Embedded Libraries
Set Build Settings > Search Paths > Framework Search Paths and Build Settings > Search Paths > Library Search Paths to $(SRCROOT) and recursive.
Verify that my deployment target matches the deployment target of the OAuthSwift Xcode project.
I have tested this using the latest version of OAuthSwift from their master branch using a git submodule, as well as manually downloading and importing each of the two latest tagged versions (0.6.0 and 0.5.2).
I have also created a brand new Xcode project, imported OAuthSwift as above, and encountered the same error.
Finally, I also tried importing a different Swift Framework (Alamofire), following the steps as stated on the README at https://github.com/Alamofire/Alamofire. This caused the same error as well: No such module 'Alamofire'.
I am using:
OSX 10.11.6
Xcode 7.3.1
Swift 2.2
I'm still fairly new to Xcode and the Swift module system, so any help or suggestions is appreciated.
Your life will be a lot easier if you import the framework using CocoaPods. If you haven't used them before, it's really easy once you get set-up. You use Ruby Gems on the command line to install CocoaPods (sudo gem install cocoapods) and then create a create a pod file using pod init. After this you modify it to include:
platform :ios, '8.0'
use_frameworks!
pod 'OAuthSwift', '~> 0.5.0'
Save the file and run pod install.
Once this is complete you will have to close out the Xcode project and use the newly created .xcworkspace project file (not the .xcodeproj) from here forward.
Here is a link to another post for a secondary reference.
How to install cocoapods?

Cocoapods doesn't see a project added to Xcode framework as viable target

I'm trying to integrate a new project into an Xcode workspace with dependencies handled by Cocoapods. I added the Backend project (builds fine on itself, returns a framework as a product) to the workspace and added a separate target in the Podfile:
target 'Backend' do
(Pod list here)
end
Yet when trying to run pod install, I get [!] Unable to find a target named 'Backend'.
Using Xcode 7.2, Cocoapods 0.39.0
CocoaPods doesn't support integrating with frameworks, see https://github.com/CocoaPods/CocoaPods/issues/3440

Cannot install Alamofire in new Xcode Project. "No Such module Alamofire"

I follow the instructions to the T. Fresh install of all, yet getting the error:
"No Such module Alamofire"
Directions here:
In the meantime, you can simply add Alamofire as a git submodule, drag the Alamofire.xcodeproj file into your Xcode project, and add the framework product as a dependency for your application target.
And my screenshots
Make sure you haven't added any files from Alamofire to your project except for the Alamofire.xcodeproj
Here is step by step instruction:
Download and unarchive Alamofire
Copy the root folder of Alamofire to any subfolder of your project. Libs, for example.
Drag and drop Alamofire.xcodeproj to your Xcode project
Open project settings of your project, Build Phases pane, expand Target Dependencies section, and add Alamofire as new dependency
Open General pane, expand Embedded Binaries section, and add Alamofire.framework
import Alamofire // in your source file
Alamofire.request(.GET, "http://httpbin.org/get") // use Alamofire
You need to add the lib to 'the Link Binary With Libraries' section also.
The target Dependencies makes sure your lib is (re)-build before your target (useful when you makes changes to the lib) and the Link section makes sure the lib is available doing the link phase.
EDIT
The above description works for most projects. However alarmofire just updated the process needed for this particular project here https://github.com/Alamofire/Alamofire
Banged my head against this for a couple days and figured I would throw this in here, our team project had this issue when bringing Alamofire in as a submodule. If you have your own scheme configurations, you need to duplicate them in the Alamofire.xcodeproj too. Which also likely means you need to fork Alamofire to keep these changes synced up.
This order of the Build Phases has worked for me.
Target Dependencies
Link Binary With Libraries.
Check Pods Manifest.lock
Embed Pods Frameworks
Compile Sources
You can rearrange Build Phases by dragging them.
After following NAlexN steps, it still didn't work for me
I also had to change the order of Build Phases.
It was
- Target Dependencies
- Compile Sources
- Link Binary With Libraries.
After I modified to:
- Target Dependencies
- Link Binary With Libraries.
- Compile Sources
It built and ran fine!
I resolved the error "No such module" for a fresh project, not for Alamofire but for another library called "RATreeView"
I had to add
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod "RATreeView", "~> 2.1.0"
to the Podfile
and ran
pod update
The key is to add use_frameworks! It might help someone
Similar errors when I used cocoapods..
I solved the problem by the following steps:
Update to Ruby 2.2.0+. (https://stackoverflow.com/a/14182172/1453505)
Update cocoapods 0.36.0+ (sudo gem install cocoapods --pre)
Again pod install
Open your project's .workspace file
Open "Manage Schemes" of your project in Xcode
Select "Alamofire" in scheme list
Clean your project
What worked for me: Including "Pods.framework" in "Linked Frameworks and Libraries" of your target if it not there already. (This applies in case you are are using cocoapods and are using frameworks as modules)
I had same issue,doing that Command+B (Build project) and disappear error.
Go to your project folder to be sure you are opening the .xcworkspace instead of the .xcodeproj file

Resources