error in xcode after pod install firebase - xcode

I am getting this error in the screenshot after trying to pod install firebase
My xcode version is 8.2
this is the content of my podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
target 'Forsa' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Forsa
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end

You need to open the file that cocoapods created: PROJECTNAME.xcworkspace (instead of the PROJECTNAME.xcodeproj file) to get access to the installed frameworks.
Or like they say in their documentation:
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace

Related

How to use cocoapods to install alamofire into watchOS app

Here's my podfile:
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment the next line to define a global platform for your project
target 'raceQs' do
platform :ios, '11.1'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for raceQs
pod 'AppCenter'
pod 'Alamofire'
end
target 'raceQs WatchKit Extension' do
platform :watchos, '4.1'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for raceQs WatchKit Extension
pod 'Alamofire'
end
I'm opening my project's xcworkspace and getting a compile error:
Developer/Xcode/DerivedData/raceQs-cwycjawfwoosfubowtoymeizvfln/Build/Products/Debug-iphoneos/raceQs.app/Frameworks/Alamofire.framework'
/Users/mac/Library/Developer/Xcode/DerivedData/raceQs-cwycjawfwoosfubowtoymeizvfln/Build/Products/Debug-iphoneos/raceQs.app/Frameworks/Alamofire.framework: bundle format unrecognized, invalid, or unsuitable
In my Xcode project Navigator, the Frameworks/ Pods_raceQs_WatchKit_Extension is displayed in red.
Any assistance would be greatly appreciated.

Working with Cocoapods + WatchOS 2 target

I have an iOS project with a lot of pods, around twenty. I want to integrate a watchOS 2 app in, but CocoaPods requires that the podspec contain support for watchOS (as seen here: http://blog.cocoapods.org/CocoaPods-0.38/)
At first, I thought I could fork all of the pods that aren't updated, point my podfile to those forked repos, and bob's your uncle. The problem is that some of the pods that I'm using are closed/not-public. Is there a way for me to not build the main application's pods for the watchOS target? Like using target isolation like so?:
target "Watch" do
end
I can't seem to get that ^ potential solution to build, as it still tries to build the pods. I've also tried this repo, no luck: https://github.com/orta/cocoapods-expert-difficulty
There are two way to integrate pods using podfile with WathOS.
1) Add Required pods directly to watch extension as below.
target '<your watch Extension Name>' do
platform :watchos, '2.0'
pod 'RealmSwift'
pod 'Alamofire'
pod 'MMWormhole', '~> 2.0.0'
end
2) Create Shared pods and add to both watch extension and iOS target both.
def sharedPods
pod 'RealmSwift'
pod 'Alamofire'
end
target '<your watch Extension Name>' do
platform :watchos, '2.0'
sharedPods
end
target '<your iOSApp Name>' do
platform :ios, '8.0'
sharedPods
end
Add only watchOS and iOS supported pods in sharedPods,
Do not add pods in sharedPods which does not support watchOS.
e.g.
def sharedPods
pod 'RealmSwift'
pod 'Alamofire'
pod 'otherWatchOS&iOS supported Pod1'
pod 'otherWatchOS&iOS supported Pod2'
end
Add only iOS supported pods in target '<your iOSApp Name>'
e.g.
target '<your iOSApp Name>' do
platform :ios, '8.0'
sharedPods
pod 'otherOnlyiOS supported Pod1'
pod 'otherOnlyiOS supported Pod2'
end
So, this way you can add required pods for required targets.
I've found my problem! I was using Swift for my Watch code, but my parent app is in Obj-c. Thought it wouldn't be a problem except the watch target attempts to compile the Swift bridging header that I use in my main app, which is what was leading to those pods building unnecessarily. So, the solution is either specify a different bridging header for your Watch target or using Obj-c!

Cocoapods No such module 'Siesta'

I've just installed Siesta (1.0-beta.4) using cocoapods, but when I try to import it with import Siesta inside a swift file I receive this error: No such module 'Siesta'
This is my Podfile:
platform :ios, '8.0'
use_frameworks!
pod 'Siesta', '~>1.0-beta.4'
I'm using xcode 7.2.
The problem was that I'm using a wrong .xcworkspace file.
Cocoapods requires to use open myapp.xcworkspace in order to open your xcodeproject correctly (with dependencies enabled correctly).
The right .xcworkspace file is in the project root.

Use of private header from outside its module error in CPTBorderedLayer.m of CorePlot

I upgraded to a new laptop with El Capitan, XCode 7.1, and Cocoapods 0.39.0. When I check out an existing project that uses the CorePlot framework, run pod install, and build the project, I get the following error messages in the CPTBorderedLayer.m file of CorePlot:
Use of private header from outside its module: '_CPTBorderLayer.h'
Use of private header from outside its module: '_CPTMaskLayer.h'
Below is a snippet of my podfile:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
target 'my_project' do
...
pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git'
This project was compiling fine using Xcode 7.0 and cocoapods 0.37.2, but I'd really rather not downgrade everything unless there are no other options.
This error has something to do with the way CocoaPods sets up the framework project. A temporary fix is to remove the use_frameworks! line from the pod file to let it build the dependencies as a static library.
Please report the problem on the Core Plot issue tracker and we'll see if this can be fixed.

Using Realm Framework in Today extension (CocoaPods)

I am using realm.io as storage for some data. I want to share this data with my Today extension. I am using CocoaPods and I am wondering how I can share that Framework with both targets. My podfile looks like this:
platform :ios, '8.0'
use_frameworks!
pod 'RealmSwift'
pod 'MBProgressHUD'
pod 'Alamofire'
I tried with this and it worked when building to device, but not when building to the iOS simulator. It returned the error 'ld: framework not found Pods':
platform :ios, '8.0'
use_frameworks!
def shared_pods
pod 'RealmSwift'
pod 'Alamofire'
end
target 'App' do
shared_pods
pod 'MBProgressHUD'
end
target 'AppToday' do
shared_pods
end
What am I doing wrong?
Appreciate any help.
Brgds
Your Podfile looks correct and would work on a clean installation. But you found a bug in the user project integration in CocoaPods when migrating between different setups.
Background info
If you don't explicitly specify a target in the Podfile, then CocoaPods will integrate with the first target in your project. This was your app target, which worked correct as long as it was the only one.
But now you're referencing explicitly to the targets. CocoaPods will create separate so called aggregate targets. Those are in the Pods.xcodeproj and named Pods-App and Pods-AppToday. These are static framework targets (from 0.39.beta.5), which are weak linked to your targets to help Xcode finding your dependencies in the Pods project. Because CocoaPods doesn't know anything about the previous Podfile when you run pod install (and it doesn't retain this information in the Podfile.lock), it doesn't remove the old aggregate target, which was named just Pods and it's product reference in your app target.
Resolving the issue
Select your project file in Xcode in the file navigator
Select your app target in the left pane from the targets list
Go to the General tab
Remove Pods.framework from the Linked Frameworks and Libraries pane
Expected state before
How it should look like
platform :ios, '8.0'
use_frameworks!
pod 'RealmSwift'
pod 'MBProgressHUD'
pod 'Alamofire'
Add this line
link_with 'App', 'AppToday'

Resources