Link Custom Framework against CocoaPod (statically) - ios

I have a podfile as follows:
platform :ios, '9.0'
#use_frameworks!
inhibit_all_warnings!
workspace 'MyWorkspace.xcworkspace'
project 'MyServices/MyServices.xcodeproj'
target 'MyServices' do
pod 'AFNetworking', '~> 3.0'
pod 'Mantle', '~> 2.0'
end
where MyServices is a framework project. Everything works fine when I compile the MyServices target. However, when MyServices framework is imported in my iOS project, I get the error:
<Mantle/Mantle.h> file not found.
<AFNetworking/AFNetworking.h> file not found.
This happens ONLY when I include the above files in my framework's public header files.
However, if I change my pod file to do use_frameworks!, it works perfectly fine even in MyServices public headers.
Any ideas?

target 'MyServices' do
platform :ios, '9.0'
pod 'AFNetworking', '~> 3.0'
pod 'Mantle', '~> 2.0'
end
try this

Related

Using a Notification Extension causes issue with Cocoapods

I have a Notification Extension in my app. However, when I build my app it conflicts with the pod FBSDKLoginKit. It gives me the following error in the FBSDKCoreKit:
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
My Podfile looks like this (I've missed out irrelevant pods):
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
end
How do I fix this?
Move your OneSignalNotificationServiceExtension target out of your main target in your Podfile. Don't forget to also define use_frameworks! in it!
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
pod install, Clean and Build and that should do the trick 👍

appcode can not load underlying module for snapkit

swift project is build and run ok in Xcode also AppCode,
but AppCode IDE report bellow error,I can not fix this .
I found UIProgressView can use progressView.snp but WKWebView can't ,
may be this is problem.
any one can help me ? Now I have to give up appcode .
see:
PodFile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.0"
use_frameworks!
target 'fruit-shop-ios' do
# pod '**', :git => 'http://**.git'
pod 'IQKeyboardManagerSwift' #,'4.0.10'
pod 'SnapKit', '~> 3.2.0'
# pod 'AFNetworking', '~> 3.0'
pod 'Alamofire', '~> 4.4'
end
the way is ignore the error.
Appcode to format and edit code, Xcode to run.

Swift Eureka error inside library after installation

I just did install Eurika library from xmartslab
I already googled this problem, unfortunally found nothing
As usual added it to my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'Project' do
pod 'Alamofire', '~> 3.0'
pod 'SDWebImage', '~>3.7'
pod 'ObjectMapper', '~> 1.1'
pod 'Eureka', '~> 1.5'
pod 'SDWebImage', '~>3.7'
end
After installation I got a bunch of errors:
What can cause this problem. Could it be any incompatibility with other libraries?
I suppose you are using Xcode 7.2 or older. You will have to upgrade to Xcode 7.3 or change your Podfile to pod 'Eureka', '~> 1.4.1'

WatchKit Can't Import Library From Pods

I'm adding a watch application, and I'm attempting to import a library within my WatchKit Extension that my iOS app uses (SwiftyJSON). I have updated my podfile as such:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'Alamofire', '~> 3.0'
pod 'AlamofireImage', '~> 2.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod "PubNub", "~> 4.1"
pod 'Siren'
end
target 'MyAppWatch Extension' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
When I run the pod install, everything seems to behave like it should. The problem is when I'm using the import SwiftyJSON inside an WKInterfaceController, I get the error No such module SwiftyJSON. Is there another setting that I haven't set properly?
The way I use to add pods to the watchOS framework with the following podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
link_with 'AppName'
target 'WatchName Extension' do
platform :watchos, '2.0'
pod 'NameOfYourPOd', '~> x.0.0'
end
But there is a very important point about the include of some libraries in the Watch Extension, there are libraries that do not support watchos as a platform yet. There are some good articles about how to add it manually to its podspec to support it.
I hope this help you

Archive build with split pods across app and watchkit extension

I have been unable to get Cocoapods to build a deployable iOS app that requires different pods for the app and the watchkit extension. I have tried a format suggested in another thread: Include pods in main target and not in WatchKit extension
but it has numerous failures, including not finding headers. Here's the closest I can get:
source 'https://github.com/CocoaPods/Specs.git'
link_with 'RailTime-WatchKit-Extension'
pod 'Reachability'
pod 'IGInterfaceDataTable'
target :'RailTime', :exclusive=>true do
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
This works fine for the simulator, but fails when trying to install on a device. The first error is:
ld: library not found for -lPods-RailTime-WatchKit-Extension
I'm using the latest Cocoapods right now .37. No errors are generated when performing a pod install.
Any help would be greatly appreciated!
Ken
Here's the general format that I use for my WatchKit app. See if this helps:
source 'https://github.com/CocoaPods/Specs.git'
target 'RailTime-WatchKit-Extension' do
link_with 'RailTime-WatchKit-Extension'
pod 'Reachability'
pod 'IGInterfaceDataTable'
end
target :'RailTime' do
link_with 'RailTime'
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
OK, the solution was quite simple, even though I'm not sure why it worked. As suggested in another thread, I did a 'pod init', which now creates a template that is knowledgable about the multiple targets. I then just filled it in! Here's what I have now:
platform :ios, '8.2'
source 'https://github.com/CocoaPods/Specs.git'
target 'RailTime' do
pod 'Reachability'
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
target 'RailTime-WatchKit-Extension' do
pod 'Reachability'
pod 'IGInterfaceDataTable'
end
target 'RailTime-WatchKit-App' do
end

Resources