Error in linking of a static iOS framework to both app's and XCTest targets

◇◆丶佛笑我妖孽 提交于 2020-01-02 16:57:39

问题


I have an app which has Objective-C and Swift combined. It has an XCTest target. I have a static framework written in Objective-C which is linked to a main target and is used by main target and test target.

I have tested 3 different cases, in which two of them compile but with warnings, while I want to see no warnings when I run my tests:

1) Static framework is not linked to test target (via Link Binary With Libraries), but is included to the test target's Framework search paths. The test target compiles but I have warning:

ld: warning: Auto-Linking supplied '.../MyStaticFramework/MyStaticFramework.framework/MyStaticFramework', framework linker option at /.../MyStaticFramework/MyStaticFramework.framework/MyStaticFramework is not a dylib

2) Static framework is linked to test target (via Link Binary With Libraries), and is included to the test target's Framework search paths. The test target compiles but I have warning:

objc[2653]: Class MyStaticFrameworkClassA is implemented in both /.../MyApp.app/MyApp and /.../MyApp.app/PlugIns/Tests.xctest/Tests. One of the two will be used. Which one is undefined.

3) Static framework is not linked to test target (via Link Binary With Libraries), and is not included to the test target's Framework search paths. The test target does not compile:

In file included from ".../Tests/.../TestFile.m:13:
.../Build/Intermediates/MyApp.build/Debug-iphonesimulator/Tests.build/../MyApp.build/DerivedSources/MyApp-Swift.h:103:9: fatal error: module 'MyStaticFramework' not found
@import MyStaticFramework;
 ^~~~~~~~

来源:https://stackoverflow.com/questions/39544257/error-in-linking-of-a-static-ios-framework-to-both-apps-and-xctest-targets

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