2014-11-21 61 views
0

我想从AFNetworking子类AFHTTPRequestOperation中进行错误处理,我正在为API创建一个SDK。子类是在Finder的Pod/Classes文件夹中创建的,其中存储了我的CocoaPods框架中的其他.h和.m文件。该框架是根据此方法创建的http://guides.cocoapods.org/making/using-pod-lib-create.htmlCocoaPods如何将Podfile中的框架的自定义子类添加到CocoaPods框架

当我试图创建一个新的可可触摸类为前述AFNetworking类的子类,添加其相应的.h和.m文件到舱体/职业目标,我得到这些错误:

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目标之外创建子类,并且在我已经安装了我的pod框架的XCode项目的目标中,则没有错误。因为它在这种情况下起作用,所以我假定我的CocoaPods框架的一部分Pod/Classes文件夹中的子类不能访问通过Podfile合并的AFNetworking框架。

会喜欢一些帮助!

回答

0

您绝对不希望在您的CocoaPods所在的位置创建子类,因为在安装/更新Pod时可能会导致问题。将子类保存在你自己的项目中(毕竟,它是你自己的文件,而不是他们的)。