aakpro
aakpro

Reputation: 1578

Can't open storyboard or xib files in xCode 6 or more

Every time I try to open storyboards and xib files in new xCode 6 or 6.1 and on Yosemite. This happens while my colleague can open it in xCode 6 on Maverick. I repeatedly get following error:

The document "MainStoryboard.storyboard" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)

I still can open it on xCode 5 on Yosemite. I also tried this method:

Open xib file in an text editor and remove all ImageViews' property of ImageName which has .png format; It helped to open some of it but not All of them!

It is a very bad situation and I am stuck!

This information are provided by console:

Exception raised while unarchiving document objects - -[NSTaggedPointerString getCharacters:range:]: Range {0, 10} out of bounds; string length 4

What is the problem and how can I solve it?

Upvotes: 0

Views: 2792

Answers (3)

toashd
toashd

Reputation: 1002

Had some similar error when opening a storyboard in Xcode 6 for the first time.

One solution, for me was to open the storyboard with your text editor of choice and manually set auto layout to false: useAutolayout="NO". Problem with this approach is that you'll loose all of your layout constraints.

Another option that worked even better for me, was to install/use Xcode 5.1, open the storyboard and, in File Inspector in section Interface Builder Document, update Opens in option to use Default (5.1), then open the storyboard again in Xcode 6.

Upvotes: 0

aakpro
aakpro

Reputation: 1578

Well the problem was with name of some images I used in UIImageViews.

I opened xib files in a text editor and find all of these patterns "X/Y.png". And I replaced it with "Y.png".

That solved my problem!

Upvotes: 2

Adrian Sluyters
Adrian Sluyters

Reputation: 2241

Back the project up before you do this but:

  1. Drop to terminal
  2. Confirm that Developer Tools are set up correctly by typing xcode-select -p (it should be /Applications/Xcode.app/Contents/Developer)

If it isn't then, it should be pointing to wherever your Xcode lives i.e. /Applications/MyDeveloperTools/Xcode.app/Contacts/Developer

You can change it by running:

 xcode-select -s /path/to/the/folder/where/xcode/is/Xcode.app/Contents/Developer

If that's all fine then.

  1. Drop to terminal (or stay there if you're still there
  2. Navigate to your project folder (where the Xibs are) n.b. its important that the above steps are right too!
  3. run ibtool --upgrade myNonWorkingXibOnXode6.xib

From here on in, that Xib should work fine.

Another note is that "compiled nibs won't work via that any more"

Upvotes: 0

Related Questions