9

I have an application that is currently working, everything's fine.

When I go to File->New->Target and add a watchkit app/extension the build is immediately broken because "Module 'Crashlytics' not found". Currently, Crashlytics is accessed using @import Crashlytics, I checked the project, and the pbxproj file has the crashlytics framework referenced to the correct location, and Crashlytics.h is visible in the project. I tried switching to #import "Crashlytics.h" just to see if maybe it was something to do with the module as opposed to simply importing the header, but then Crashlytics.h file not found.

Crashlytics has been in the project for a very long time, working perfectly. Is there something extra required when adding in the watch extension while using external frameworks or pods?

(If I comment out the line altogether, just to see what happens, I get a similar issue for one of the cocoapods we're using, and I'd be willing to be if I went along commenting things out I'd end up having to remove anything that's an external framework)

4

3 回答 3

9

Podfile.

link_with 'appName', 'appName WatchKit Extension'

pod 'Alamofire', :git => "git@github.com:Alamofire/Alamofire.git", :branch => 'xcode-6.3'
pod 'SwiftyJSON', :git => "git@github.com:SwiftyJSON/SwiftyJSON.git", :branch => 'xcode6.3'
于 2015-02-26T20:45:16.877 回答
3

其实我自己找到了答案。和往常一样,这很愚蠢但很重要。当我添加扩展时,第三方库和框架并没有自动添加到目标中,所以我必须返回并“添加文件”才能将 Crashlytics 框架添加到 WatchKit 扩展目标中。

此外,事实证明这是一个更广泛的问题。我的猜测是,当添加任何扩展时,任何第三方库或框架都可能会出现这个问题。我的 cocoapods 也有问题,必须在 podfile 中添加:link_with 'target1', 'target2' 以确保将 pod 添加到的不仅仅是默认的第一个目标。

不过,斯蒂芬约翰逊的道具,对于这类问题,标题和库搜索路径是检查调试的好地方。

于 2015-01-05T18:42:19.513 回答
0

我必须在构建设置中为我的手表套件扩展目标更新我的标题搜索路径。对于我的应用程序,我使扩展程序的标题搜索路径与我的应用程序的标题搜索路径匹配。

在此处输入图像描述

于 2014-12-18T21:30:37.720 回答