Xcode 7 ibtool error: Deploying Storyboard Referen

2019-04-09 04:16发布

问题:

I have an iOS app targeting iOS 8 and 9 which I'm in the process of upgrading to use Storyboard References instead of links through code. I've gradually converted more and more bits over, when suddenly I started getting this compiler error:

: error: Deploying Storyboard References to iOS 8.0 requires that your storyboards do not share any view controller identifiers. A.storyboard and Z.storyboard both contain a view controller with identifier "ZNavigationController".

Z.storyboard absolutely contains ZNavigationController, it's supposed to be there, however A.storyboard assuredly does not contain any such navigation controller. I've opened the .storyboard file in a text editor and verified that there is no mention of ZNavigationController.

To give some more context:

  • A.storyboard has a reference to B.storyboard, and it has a manual segue from one of the viewControllers in A
  • B.storyboard has a reference to Z.storyboard - it gets there via a manual segue from one of the viewControllers in B

Running XCode Version 7.0 (7A218) which is the GM seed build

回答1:

Found the problem (I'm using Xcode 7.1.1).

After using Product --> Refactor to storyboard, it create a storyboard references with a storyboard ID same than the reference ID (attributes & identity inspector).

This is a bug, storyboard ID should be nil and only the reference ID should be filled.

Update #1 : When creating multiple storyboard reference using "Refactor to storyboard", it create the same object ID which cause this error too.

Update #2 : Just don't use the "Refactor to storyboard" feature if you target iOS 8. It create multiple doublons with objectId which cause an error like :

/* com.apple.ibtool.errors */ : error: Deploying Storyboard References to iOS 8.0 requires that your storyboards do not share any view controller identifiers. Category.storyboard and Home.storyboard both contain a view controller with identifier "UIViewController-BX3-FJ-k0T".


回答2:

I did a bit more digging and it turns out that even though A.storyboard didn't have anything with that storyboard ID, there was a controller in B.storyboard and also in Z.storyboard which both had the Storyboard ID of ZNavigationController. The one in B.storyboard had an incorrect ID which I removed.

Looks like Xcode is misattributing the (correct) error to A.storyboard instead of B



回答3:

First you need to find which Reference is doubled UIViewController-5kv-Ul-Bah - it was my error

Press cmd + 3 and input id (5kv-Ul-Bah) without "UIViewController-" find doubled references

You should see something like this

In my case it is InvitationDetails.storyboard and Location.storyboard

You have 2 options:

Option 1: Remove Storyboard Reference from storyboard and add another one (do this with my other instructions https://stackoverflow.com/a/33753164/2493555)

Option 2: Open new created storyboard as source code

then find our id and change it to another like "5kv-Ul-Bahxx" (I add xx postfix) but you need to be sure that string "5kv-Ul-Bahxx" is not exist in project (by pressing cmd + 3 and find)



回答4:

  • Click on the offending storyboard reference
  • Open the identity inspector
  • Delete the "Storyboard ID".

As far as I can tell, there's no need to reference a reference, and this seems to be the thing it's complaining about. When you use 'refactor to storyboard', it leaves the storyboard id in the reference.