我完全卡住嘗試使用AFNetworking在模擬器上運行項目。我之前在其他項目中使用過這種依賴關係,所以我不明白這裏出了什麼問題。首先,當我嘗試運行項目的錯誤:AFNetworking將無法編譯
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_CLASS_$_SharedNetworkObject in SharedNetworkObject.o
"_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
objc-class-ref in SharedNetworkObject.o
"_OBJC_METACLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_METACLASS_$_SharedNetworkObject in SharedNetworkObject.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我敢肯定,這是問題的一部分,但我不知道如何解決它:
這是有問題的.h文件中:
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import "SharedSessionKey.h"
@interface SharedNetworkObject : AFHTTPSessionManager
+ (SharedNetworkObject *) sharedNetworkObject; // class method to return the singleton object
@end
這可能感興趣的是,當我開始打字AFNetworking導入行,行之後幾個字符填充,所以我知道有一些意識到AFNetworking依賴的存在。
我使用CocoaPods安裝了依賴項。這裏是我的Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'WeRun' do
pod "AFNetworking", "2.5.2"
end
target 'WeRunTests' do
end
,當然我在.xcworkspace
(未.xcodeproj
)我的工作。
還有一兩件事,我xcconfig文件看起來像這樣,與其他成功的AFNetworking構建匹配:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_LDFLAGS = -ObjC -l"Pods-MyApp-AFNetworking" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_ROOT = ${SRCROOT}/Pods
我不知道要尋找別的什麼。我已經完全刪除了該吊艙並重新安裝,只是爲了找到完全相同的錯誤。任何人都可以幫我解決這個問題嗎?謝謝!
https://github.com/AFNetworking/AFNetworking/issues/2324 – Klevison 2015-04-02 16:20:35
僅將構建活動架構設置爲是 – Jassi 2015-04-02 16:28:28
@Jassi - 沒有工作。 – Alex 2015-04-02 16:30:04