我的iOS应用有多个扩展:
- today扩展
- siri扩展
- imessage扩展
target 'MyApp' do
pod 'MyFramework', :path => './MyFramework'
target 'MyAppTests' do
inherit! :search_paths
end
end
abstract_target 'Extensions' do
pod 'MyFramework', :path => './MyFramework'
target 'TodayExtension'
target 'SiriExtension'
target 'iMessageExtension'
target 'ExtensionsTests'
end
你看到我创建了ExtensionsTests
目标,但我不知道如何继承所有扩展的搜索路径。 我还尝试使用@testable import TodayExtension
,但我得到了“未定义符号”链接错误,对于架构x86_64。
有什么想法可以解决这个问题吗?
完整的错误代码:
Undefined symbols for architecture x86_64:
"type metadata accessor for TodayExtension.LoadingView", referenced from:
ExtensionTests.LoadingViewTests.setUp () -> () in LoadingViewTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
编辑:
我认为这个问题是普遍的: 我如何测试任何扩展代码? 我创建了一个单一的视图项目,添加了今天的扩展,但我无法访问扩展代码。
在苹果文档中只有这些信息:
使用Xcode测试框架(即XCTest APIs)测试应用程序扩展,请编写测试,使用您的包含应用程序作为主机环境来执行扩展代码。要了解更多关于测试的信息,请参见 Xcode 测试。
这并不是很有帮助。
Build Active Architecture Only
设置为NO
。 - shallowThought