2014-11-21 108 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時可能會導致問題。將子類保存在你自己的項目中(畢竟,它是你自己的文件,而不是他們的)。