我创建了 2 个 xcode 项目“mylib”和“myapp”
这两个项目都依赖于“AFNetworking”,所以我在下面写了Podfile。
workspace 'myapp'
platform :ios,'7.0'
xcodeproj 'myapp/myapp.xcodeproj'
target :myapp do
xcodeproj 'myapp/myapp.xcodeproj'
pod 'AFNetworking', '~> 2.5.4'
end
target :mylib do
xcodeproj 'mylib/mylib.xcodeproj'
pod 'AFNetworking', '~> 2.5.4'
end
运行“pod install”后,我得到了 https://github.com/everettjf/cocoapods_two_projects_obj69272 ,并且构建没有错误。
但是当我在“iOS 模拟器”中运行时,控制台窗口中会输出大量警告消息。
objc[69590]: Class AFHTTPRequestOperation is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc[69590]: Class AFHTTPRequestOperationManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc[69590]: Class AFHTTPSessionManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc[69590]: Class AFNetworkActivityIndicatorManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
...(more)
我该如何解决?谢谢。
最后,我找到了 2 个解决方案。
解决方案 1
mylib -> TARGETS(mylib) -> build设置 -> 链接 -> Mach-O 类型:静态库
解决方案 2
只需添加“use_frameworks!”到 Podfile
更多信息,请参阅here
关于ios - 将 CocoaPods 与 2 个项目一起使用时的运行时输出 objc[69590],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32109812/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |