AFNetworking 2.0 “_NSURLSessionTransferSizeUnknown” linking error on Mac OS X 10.8

心已入冬 提交于 2019-12-13 04:34:20

问题


I'm using

  • AFNetworking 2.0
  • Mac OS X 10.8.0
  • Xcode 5

But I'm receiving the following error:

Undefined symbols for architecture x86_64:
  "_NSURLSessionTransferSizeUnknown", referenced from:
      -[AFURLSessionManagerTaskDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:] in AFURLSessionManager-C493EEE75215474B.o
      -[AFURLSessionManager uploadTaskWithTask:progress:completionHandler:] in AFURLSessionManager-C493EEE75215474B.o

ld: symbol(s) not found for architecture x86_64
clang: error: `linker command failed with exit code 1 (use -v to see invocation)`

I'm using AFNetworking 2.0 in an Mac OS X project...


回答1:


If you are using Mac OS 10.8, the error seems plausible, because NSURLSessionTransferSizeUnknown (and NSURLSession and AFURLSessionManager) requires Mac OS 10.9 or iOS 7.0 and later.

There was a rendition of AFNetworking 2.0 that was not correctly checking the OS version and trying to include AFURLSessionManager even when using targets prior to 10.9 and iOS 7.0. This has since been remedied, and this particular problem should go away if you update your AFNetworking 2.0 code to the latest version.




回答2:


Try adding the following frameworks:

SystemConfiguration
Security
CFNetwork



回答3:


For those of you who crashes on ios 6 sdk and using cocoapods check on your pod file. platform :ios, '6.0' needs to be 6 not 7

Solved the problem for me.



来源:https://stackoverflow.com/questions/21225976/afnetworking-2-0-nsurlsessiontransfersizeunknown-linking-error-on-mac-os-x-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!