Upgrade Xcode 7.3.1 Project to Xcode 8.0

拜拜、爱过 提交于 2020-01-17 18:02:29

问题


I want to upgrade my Xcode 7.3.1 Project to Xcode 8. My project was written in swift 2.2 in Xcode 7 but now I want to upgrade to Xcode 8 with swift 3.0. My project contains some pod-files library while upgrading to Xcode 8, I am facing lots of warning and error. Warning related to storyboard is solved but Error in pod files are not solved.

Xcode tell me to convert swift syntax to latest syntax so I did it. Swift syntax error shows in pod-files. I am trying to solve pod file swift syntax error then Xcode tell me to unlock pod-files, I did it but then pods are not working.

Is any one knows how to solve pod-files error? or How to convert whole Xcode 7.x project to Xcode 8?


回答1:


The final answer of above question is:

add the code snippet in your podfile

   post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '3.0'
     end
    end
  end

then check swift legacy in build settings and set it to NO for swift 3 or you can set Yes for swift 2.3 (if you are using objective-c pod repository)

Check all the pod repository one by one if its update contain swift3 code then fine or you can manually add code with swift 3 syntax by pull the request from github.

If my answer is wrong then edit it guys




回答2:


Step 1 : Open Project in Xcode 8.0

Step 2 : Go to Edit > Convertor > To Current Swift syntax.

Step 3 : Select in which swift version want to convert.




回答3:


There’s a single build setting that will let you continue building your Swift projects with a Swift version that’s mostly similar in syntax to your existing projects from Xcode 7: Use Legacy Swift Language Version

Just drop into your project’s build settings and search for legacy swift to find the correct build setting, then switch the setting to YES to opt-in to Swift 2.3 rather than Swift 3 in Xcode 8.


来源:https://stackoverflow.com/questions/39613758/upgrade-xcode-7-3-1-project-to-xcode-8-0

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