gpt4 book ai didi

ios - AFNetworking 不在 xcode8 上使用 cocoapods 构建

转载 作者:行者123 更新时间:2023-11-29 00:31:59 28 4
gpt4 key购买 nike

我在 cocoapods 1.1.1 上,并尝试使用 pod install 安装此文件:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target "Pictabite" do
pod 'AFNetworking', '~> 3.1'
pod 'SDWebImage', '~>3.8'
pod 'LLSimpleCamera', '~> 5.0'
end

但是,在我添加 AFNetworking 后项目没有构建。我在 Xcode 上收到此错误:

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AFNetworkReachabilityManager", referenced from:
objc-class-ref in AppDelegate.o
objc-class-ref in UIDevice+Category.o
"_OBJC_CLASS_$_AFNetworkActivityIndicatorManager", referenced from:
objc-class-ref in PBHttpSessionManager.o
"_OBJC_CLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_CLASS_$_PBHttpSessionManager in PBHttpSessionManager.o
_OBJC_CLASS_$_PBHttpFQSessionManager in PBHttpFQSessionManager.o
"_OBJC_METACLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_METACLASS_$_PBHttpSessionManager in PBHttpSessionManager.o
_OBJC_METACLASS_$_PBHttpFQSessionManager in PBHttpFQSessionManager.o
"_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
objc-class-ref in PBHttpSessionManager.o
objc-class-ref in PBHttpFQSessionManager.o
"_OBJC_CLASS_$_AFHTTPRequestSerializer", referenced from:
objc-class-ref in PBHttpSessionManager.o
objc-class-ref in PBHttpFQSessionManager.o
"_OBJC_CLASS_$_AFSecurityPolicy", referenced from:
objc-class-ref in PBHttpSessionManager.o
ld: symbol(s) not found for architecture x86_64
clang-real: error: linker command failed with exit code 1 (use -v to see invocation)

有什么想法吗?

最佳答案

不指定 cocoapods 版本,并使用 use_frameworks! 会产生:

Installing AFNetworking (3.0.4)
Installing LLSimpleCamera (4.2.0)
Installing SDWebImage (3.7.5)

  • pod --version:1.1.1
  • xcodebuild -version:Xcode 8.2.1,构建版本 8C1002

您的 Podfile 可能如下所示:

platform :ios, '10.0'

target 'Pictabite' do
use_frameworks!

pod 'AFNetworking'
pod 'SDWebImage'
pod 'LLSimpleCamera'
end

Swift 3 编译示例

import AFNetworking
...
let configuration = URLSessionConfiguration.default
let manager = AFURLSessionManager(sessionConfiguration: configuration)

Objective-C 编译示例

#import "AFNetworking.h"
...
NSURLSessionConfiguration *configuration =
[NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager =
[[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

关于ios - AFNetworking 不在 xcode8 上使用 cocoapods 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41516932/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com