简体   繁体   中英

Backward compatibility of Storyboards from Xcode 6 to Xcode 5 + Support iOS 7 in Xcode 6

After making some changes in my project under Xcode 6 , I can't open storyboard file (and build project) from Xcode 5.

Since there is no way to Distribute apps to AppStore from Xcode 6, while it under beta - I have to build application under Xcode 5.

Is any way to make storyboard backward compatibile with Xcode 5 ? I found in the header of storyboard file this string:

<capability name="Constraints with attributes relative to the layout margin" minToolsVersion="6.0"/>

I suppose, that it's need to delete or edit some new keys, that new Xcode 6 uses, but can't detect which one.

(Revert commit is VERY unlikely, because there is a LOT of changes.)

在此输入图像描述


UPD:

There is another problem, that appears in Xcode 6 - it adds baseline constraints, that not available in iOS 7 , and it cause crashes on it. (Xcode even not always highlight this warnings!) - to fix it refer to my answer, how to remove baseline attributes.

Hooray! I fix it! Hope It will be useful for others:

I use regex to find all dummy strings (regex version that support Sublime 2 )

  1. Open your stroyboard file in favorite text editor.
  2. find all using regex (\\w)Margin"
  3. Replace all occurrences by pattern: \\1"
  4. remove <capability name="Constraints with attributes relative to the layout margin" minToolsVersion="6.0"/> from beggining of file.
  5. Find and remove from storyboard file all strings by pattern: .*"baseline".*\\n
  6. To fix misaligns: Open file in Xcode 5 - and Update constraints for all views.
  7. That's it! Profit!

UPD: I found that "baseline" constraints causes crashes also, but Xcode doesn't show any warnings about these constrains!

To fix it - remove from storyboard file all strings by pattern: .*"baseline".*\\n

Open your storyboard in editor. Right click> open in editor. Copy your ui xml leaving out the header where you would find the version and storyboard id.

Next, paste your xml content to your xcode 5 storyboard file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM