zoukankan      html  css  js  c++  java
  • AFNetworking 使用中报错

    好久没用 http相关的库,今天使用, 选用AFNetworking,github下载,引入工程,记录下中间使用中遇到的问题

     

    1.在非ARC工程中使用ARC的文件,在project->Build Phases->Compile Sources 文件编辑参数 -fobjc-arc

     PS:在ARC项目中使用非ARC文件:文件编辑参数 -fnoobjc-arc

     

    2.编译时报错,

    Undefined symbols for architecture i386:
      "_UTTypeCopyPreferredTagWithClass", referenced from:
          _AFContentTypeForPathExtension in AFURLRequestSerialization.o
      "_UTTypeCreatePreferredIdentifierForTag", referenced from:
          _AFContentTypeForPathExtension in AFURLRequestSerialization.o
      "_kUTTagClassFilenameExtension", referenced from:
          _AFContentTypeForPathExtension in AFURLRequestSerialization.o
      "_kUTTagClassMIMEType", referenced from:
          _AFContentTypeForPathExtension in AFURLRequestSerialization.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    解决 project->Build Phases-> Link Binary With Libraries 添加
    MobileCoreServices.framework
    SystemConfiguration.framework

    3. 请求url 出现错误:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. 
    原因iOS9引入了新特性App Transport Security (ATS),要求App内访问的网络必须使用HTTPS协议。

      解决方案: 1.在Info.plist中添加NSAppTransportSecurity类型Dictionary

           2.在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

    4.编译出现   AF_Require_noErr(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);  出现kSecFormatUnknown无法识别  如果是2.6版本,请换2.5 就没问题了

     

  • 相关阅读:
    二叉树的深度(剑指offer)
    平衡二叉树(剑指offer)
    平衡二叉树
    513. Find Bottom Left Tree Value(得到左下角的节点)(树的层次遍历)
    637. Average of Levels in Binary Tree(一棵树每层节点的平均数)(二叉树的层序遍历)
    145. Binary Tree Postorder Traversal(非递归实现二叉树的后序遍历)
    正则表达式式总结
    re模块
    生成器 生成器函数 列表推倒式 生成器表达式
    闭包,迭代器
  • 原文地址:https://www.cnblogs.com/liumianweifeng/p/4818778.html
Copyright © 2011-2022 走看看