iOS项目中难题 ios项目难点怎么回答

admin2024-06-05  11

    网易视频云是网易推出的视频云服务,目前已经y广泛应用于在线教育、秀场直播、远程医疗、企业协作等领域。现在,网易视频云的技术专家们给大家分享一则移动APP测试技术文:IOS工程常见问题解决方法。

  最近在做IOS测试时,碰到了几个环境引起的问题,主要是开发工具新版本及IOS系统新版本特性导致。现挑取两个比较典型的问题来分享给大家。

  1. Xcode版本引出的问题

  问题描述:开发提测时,创建的工程是在xcode6版本上创建的,而测试环境使用新的版本Xcode7,将开发提测工程导入后进行编译报如下错误:

  ld: '/Users/netease/Downloads/nos-ios-demo-for-stabilitytest/NOSSDKDemo/libnos ios SDK.a(NOS.o)' does not contain bitcode. You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode forthis target. for architecture arm64clang: error: linker command failed with exit code 1 (use -v to see invocation)

  具体如图显示:

  

iOS项目中难题 ios项目难点怎么回答,iOS项目中难题 ios项目难点怎么回答_iOS项目中难题,第1张

  问题分析: 通过编译过程所报的错误,很明显的可以看出是第三方库不包含bitcode问题,具体来看下官方对于bitcode解释

  Bitcode is an intermediate representationof a compiled program. Apps you upload to iTunes Connect that contain bitcodewill be compiled and linked on the App Store. Including bitcode will allowApple to re-optimize your app binaryin the future without the need to submit anew versionof your app to the store.Bitcode. When you archive for submission tothe App Store, Xcode will compile your app into an intermediate representation.The App Store will then compile the bitcode down into the 64or32 bitexecutables as necessary.

  通过上面的解释我们可以看出,bitcode属于被编译程序的一种中间形态,类似于c中的.o文件。当新的app软件需要发布时,只需要提交对应的二进制文件,剩下的事情交给AppStore来完成,无需通过Appstore提交发布新的版本。

  针对上面的问题,官方也给出了解决方法:

  You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, ordisable bitcode forthis target. for architecture arm64

  由于Xcode7默认开启bitcode,且此选项对于非watch App来说是可选的,故最好的解决方法便是将bitcode开关关掉,具体如下图:

  

iOS项目中难题 ios项目难点怎么回答,iOS项目中难题 ios项目难点怎么回答_技术开发_02,第2张

  2.IOS版本引出的问题

  当前IOS发布了9.0以上版本,但IOS9有一个新的特性,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据,当拿原有的工程在9.0以上版本编译运行时会有以下错误: 使用普通HTTP请求报如下错误:

  Application Transport Security has blocked a cleartext HTTP(http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

  来看下官方给出解释:

  If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can rightnow, andcreate a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version1.2with forward secrecy. If you try to make a connection that doesn't follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app's Info.plist file.

  针对这个问题的快速解决方法便是修改plist文件,具体修改如下: 在Info.plist文件中添加如下配置:

  ....NSAppTransportSecurityNSAllowsArbitraryLoads

  界面修改配置,如图:

  

iOS项目中难题 ios项目难点怎么回答,iOS项目中难题 ios项目难点怎么回答_技术_03,第3张

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!