【发布时间】:2015-01-19 02:09:06
【问题描述】:
我正在尝试从 AFNetworking 子类化 AFHTTPRequestOperation,以便在我为 API 创建的 SDK 中进行错误处理。子类在 Finder 的 Pod/Classes 文件夹中创建,其中存储了我的 CocoaPods 框架中的其他 .h 和 .m 文件。该框架是根据此方法 http://guides.cocoapods.org/making/using-pod-lib-create.html 创建的。
当我尝试创建一个新的 Cocoa Touch 类作为上述 AFNetworking 类的子类并将其对应的 .h 和 .m 文件添加到 Pods/Classes 目标时,我收到以下错误:
Ld /Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Products/Debug-iphonesimulator/OSB-iOS-SDK.bundle/OSB-iOS-SDK normal i386
cd /Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Pods
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Products/Debug-iphonesimulator -F/Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Products/Debug-iphonesimulator -filelist /Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Intermediates/Pods.build/Debug-iphonesimulator/OSB-iOS-SDK.build/Objects-normal/i386/OSB-iOS-SDK.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -Xlinker -dependency_info -Xlinker /Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Intermediates/Pods.build/Debug-iphonesimulator/OSB-iOS-SDK.build/Objects-normal/i386/OSB-iOS-SDK_dependency_info.dat -o /Users/bryanboyko/Desktop/XCode/1StudentBody_iOS_Framework/Example/Build/Products/Debug-iphonesimulator/OSB-iOS-SDK.bundle/OSB-iOS-SDK
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AFHTTPRequestOperation", referenced from:
_OBJC_CLASS_$_OSBRequestOperation in OSBRequestOperation.o
"_OBJC_CLASS_$_AFHTTPRequestOperationManager", referenced from:
_OBJC_CLASS_$_OSBRequestOperationManager in OSBRequestOperationManager.o
"_OBJC_CLASS_$_AFHTTPResponseSerializer", referenced from:
objc-class-ref in OSBRequestOperation.o
"_OBJC_METACLASS_$_AFHTTPRequestOperation", referenced from:
_OBJC_METACLASS_$_OSBRequestOperation in OSBRequestOperation.o
"_OBJC_METACLASS_$_AFHTTPRequestOperationManager", referenced from:
_OBJC_METACLASS_$_OSBRequestOperationManager in OSBRequestOperationManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: symbol(s) not found for architecture i386
如果我在 Pods 目标之外和在我安装了我的 pods 框架的 XCode 项目的目标中创建子类,则不会出现错误。因为它在这种情况下有效,所以我假设我的 Pod/Classes 文件夹中的子类是我的 CocoaPods 框架的一部分,它们无法访问通过 Podfile 合并的 AFNetworking 框架。
希望得到一些帮助!
【问题讨论】:
标签: ios architecture frameworks subclass cocoapods