Cocoa pods and Watchkit Extesion

老子叫甜甜 提交于 2019-12-20 21:05:12

问题


I try to build a WatchKit Extension for my app...

I Updated the pods file to look like this:

platform:ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

link_with 'my-team-ios', 'My Team WatchKit Extension'

def shared_pods
    pod 'DOSingleton'
    pod 'JSONModel'
    pod 'MagicalRecord'
end

target :'My App' do
    shared_pods
    pod 'Facebook-iOS-SDK', '~> 3.23.1'
    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
    ... some more pods here...
end

target :'My Team WatchKit Extension' do
    shared_pods
end

How I install the pods and don't get an error...

But, when I build the App, I get this error:

ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is my problem here?


回答1:


You need to open the xcworkspace file instead of the project file when using CocoaPods.




回答2:


The problem is when updating to cocoapods 0.36.x they are now creating Frameworks out of each pod library. See the blog post about it.

This causes issues with any pod library that is dependent on other pods and how its referencing them in their import statements, or how your code is importing them as well. The Pod process now turns them into frameworks and when they used to be imported as

#import "ThisOtherPodClass.h"

Now need to be imported as

#import <ThisPodsFrameworkName/ThisOtherPodClass.h>




回答3:


There is a new version of cocoa pods .38, that is designed to support WatchKit. However, if you want to work with the current version, check o make sure that libPods.a is added to the Target, WatchKit Extension in Included Libraries and Frameworks. Second, make sure that Pods.debug and Pods.release are added to Watchkit Extension in the General tabl




回答4:


https://github.com/CocoaPods/CocoaPods/issues/3382

neonichu commented on Apr 15, 2015 would start by making sure OTHER_LDFLAGS isn't overwritten with unnecessary things, both in the project and the targets.

That set OTHER_LDFLAGS in buids settings solved my issus.




回答5:


I'm using Pod 1.2.1 and facing the same problem i.e. No such module XYZ and for anyone who came across the same issue here what I did to overcome it:

use_frameworks!

def shared_pods
    pod 'XYZ'
end

target 'MyApp' do
    platform :ios, '8.0'

    shared_pods

    pod 'Blah'
    pod 'blah'

end

target 'Watch Extension' do
    platform :watchos, '3.2'
    shared_pods 
end

I just added platform under each target e.g platform :watchos, '3.2' which was missing before and it solved my problem.




回答6:


Try to change this lines

target :'My App', target :'My Team WatchKit Extension'

and remove colons:

target 'My App', target 'My Team WatchKit Extension'




回答7:


I found a "temporally solution" for me: Switch back to CocoaPods 0.35

Now everything is working fine, with our any changes to my project / pod file (except removing the 'use_frameworks!')

I think, that should not be the final solution here...

A short test by upgrading again to 0.36 raises the same problem as before...

Here is a link to the GitHub Issue:




回答8:


Rename the target so it doesnt include any spaces -> MyTeamWatchKitExtension both in podfile and also in General -> Targets. This solved my problem



来源:https://stackoverflow.com/questions/29519536/cocoa-pods-and-watchkit-extesion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!