将 CocoaPods 与 2 个项目一起使用时的运行时输出 objc[69590]
runtime output objc[69590] when using CocoaPods with 2 projects
我创建了 2 xcode 个项目 "mylib" 和 "myapp"
- mylib的项目类型是"iOS -> Cocoa Touch Framework"
- myapp 的项目类型是"iOS -> Application -> Single View Application".
这两个项目都依赖于"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 simulator" 中 运行 时,控制台中输出了很多警告消息 window。
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)
我该如何解决?谢谢
分别为两个项目创建 pod。
用这个link来指代:http://www.raywenderlich.com/64546/introduction-to-cocoapods-2
最后,我找到了2个解决方案。
解决方案 1
mylib -> TARGETS(mylib) -> 构建设置 -> 链接 -> Mach-O 类型:静态库
解决方案 2
只需添加“use_frameworks!”到 Podfile
更多信息,请参阅here
我创建了 2 xcode 个项目 "mylib" 和 "myapp"
- mylib的项目类型是"iOS -> Cocoa Touch Framework"
- myapp 的项目类型是"iOS -> Application -> Single View Application".
这两个项目都依赖于"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 simulator" 中 运行 时,控制台中输出了很多警告消息 window。
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)
我该如何解决?谢谢
分别为两个项目创建 pod。
用这个link来指代:http://www.raywenderlich.com/64546/introduction-to-cocoapods-2
最后,我找到了2个解决方案。
解决方案 1
mylib -> TARGETS(mylib) -> 构建设置 -> 链接 -> Mach-O 类型:静态库
解决方案 2
只需添加“use_frameworks!”到 Podfile
更多信息,请参阅here