我正在我的应用程序中实现AFNetworking。
我已在我的应用程序中成功导入文件夹AFNetworking和UIKit + AFNetworking。我的代码如下。
#import "AFNetworking/AFHTTPRequestOperationManager.h"
- (void)viewDidLoad {
[super viewDidLoad];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"foo": @"bar"};
[manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
// Do any additional setup after loading the view, typically from a nib.
}
上面的代码不是实际的代码,而只是检查一切是否正常工作,但是在这里我得到了错误:
找不到体系结构x86_64的符号
我引用了Stack Overflow的几个链接,但无法解决问题。
我遇到了同样的问题,问题是目标的其他链接标志字段
[!] The `SPEEPHOTAG [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `SPEEPHOTAG [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[当我将$(inherited)
写入其他链接标志时,它为AFNetworking
添加了必需的标志并且问题已为我解决。