簡體   English   中英

AFNetworking不在xcode8上使用cocoapods構建

[英]AFNetworking doesn't build with cocoapods on xcode8

我正在使用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!使用use_frameworks! 產量:

安裝AFNetworking(3.0.4)
安裝LLSimpleCamera(4.2.0)
安裝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];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM