16

After opening my project in the Xcode5 developer preview, errors appeared against a few .xib files when I tried to open the project in Xcode 4.5. The error text was:

 The document "XXXX.xib" could not be opened. Could not read archive.

 Please use a newer version of Xcode. Consider changing the document's Development Target to preserve compatibility.

The project's development target in Xcode5 appears to be iOS 5.0.

Looking at the source code of the .xib files with errors, it is clear that the .xml structure for .xib files in Xcode5 has changed quite dramatically, and it needs to be reformatted to be backwards compatible.

Is there a way to set development targets for specific .xib files? Does anyone know how this error can be resolved?

Many thanks.

Spinoxa
  • 657
  • 2
  • 7
  • 23
  • This would be a great time to suggest and try to not sound smug when saying... just take a look at your SCM log to see what Xcode changed, and revert. – Daniel Jun 17 '13 at 20:51
  • How do I see the SCM log? Sorry, I don't think this was a question worthy of a mark down... I'm an amateur developer seeking help to resolving these problem, which I'm sure many other people experience. – Spinoxa Jun 17 '13 at 21:19
  • Check my comment on answer please. And also + 1 for asking a good question.:) – Adrian P Jun 17 '13 at 21:22
  • For any other questions on iOS 7/Xcode 5 etc... please visit the beta section of the Apple Developer Forums. These betas are under NDA. https://devforums.apple.com/community/ios/ios7_beta – Daniel Jun 17 '13 at 22:25
  • Please check my answer. You don't have to use source control to solve it... – Idan Jun 21 '13 at 11:54
  • @Spinoxa. If you have backup copy of project, try to work on it – Gajendra K Chauhan Sep 20 '13 at 05:46
  • One thing I would like to add is use Xcode 5 (Final release) instead of Xcode 5 preview. This is because I encountered a Bug in Xcode 5 preview which got automatically after switching to Xcode 5 (Final release). – Jayprakash Dubey Nov 06 '13 at 06:15

7 Answers7

14

Just open Storyboard in XCode 5, into right panel and "File Inspector" tab do:

  1. edit your "Interface Builder Document" like follow:

enter image description here

  1. Save it and open in previous XCode.
orafaelreis
  • 2,855
  • 2
  • 28
  • 31
  • 1
    Thanks dude... But Is there any way to change all .XIBs in one time or I have to do it individually for all XIBs – MilanPanchal Dec 16 '13 at 07:23
  • 1
    I believe that you need do it with each XIB file. It happens because the files were parsed to other format when you saved it in XCode 5 for the first time. – orafaelreis Dec 27 '13 at 18:24
13

First of all open project with Xcode5. and then

  • select XXX.xib find Interface Builder Document
  • Opens in Xcode 4.6(if is 5.0)
  • close project
  • open it with 4.6
j0k
  • 22,600
  • 28
  • 79
  • 90
user2518512
  • 240
  • 2
  • 6
6

A better and easier solution that works even if your project isn't under source control can be found here (mine):

Just installed xcode 5 and have missing storyboards

Hope that helps.

Community
  • 1
  • 1
Idan
  • 9,880
  • 10
  • 47
  • 76
5

It's a current problem when you open your Xcode 4.6 project with the new XCode 5. To reuse correctly your XIB with Xcode 4.6 :

1 Open your project with XCode 5

2 Select your Xib to restore

3 In the File Inspector Section, in "Interface Builder Document", select Xcode 4.6 in the Development's version of Document Versioning

4 Build and close

5 Reopen your project with XCode 4.6

It's possible to have some regression with elements width & size in your XIB, but it was restored successfully.

Cheers,

Maulik
  • 19,348
  • 14
  • 82
  • 137
jc_35
  • 1,073
  • 1
  • 9
  • 15
4

well obviously you created your project prior to the new xcode developer preview. then you tried opening your project with the new DP and boom, it automatically changed everything in your xibs to be able to present your xibs in a higher version. easy to fix. with your xcode 4 ios 6 open the same project, then right click on the name of the xib that is not opening and select source control and from there select discard changes. that should return the xib back to the shape it was before you opened it with the new xcode DP.

let me know if you need more help but that should take care of your problem.

Adrian P
  • 6,479
  • 4
  • 38
  • 55
  • Unfortunately I didn't use source control so 'discard changes' took it back to a version from about 1 year ago! However, I did have a snapshot from 2 weeks ago and I should be able to rebuild the changes since then. How can I configure the project to have better source control? Is there a way to set-it up so that it auto-commits so you can always step back? Or does it have to be done manually? – Spinoxa Jun 17 '13 at 21:16
  • You can create a local git and set it to auto refresh. The other way I use is to use snapshots. You can also adjust your source control from the settings within xcode. There might be other ways too but those are the ones I know. Good luck and if my answer helped will you please check it as the correct one. – Adrian P Jun 17 '13 at 21:21
  • Thanks for your advice, I'd been using snapshots but not proper source control, but I shall do that more from now on. Thanks for your help, and thanks also for reverting that idiotic -1 vote on a perfectly valid question. – Spinoxa Jun 17 '13 at 21:37
  • Check my answer, You don't have to use source control to fix that. Although using source control is a good practice always. – Idan Jun 18 '13 at 19:53
  • using source control will ensure the saftey of the project and a point to return to. as i said in my previouse comments there are other ways, but i use source control since it providees more safety for me. and as you mentioned is a very good practice. – Adrian P Jun 18 '13 at 20:26
  • @Spinoxa You can setup a "Behavior" in Xcode preferences that creates a snapshot after each successful build (for example). I think the snapshot feature actually uses git internally, too. – Tomas Andrle Jun 26 '13 at 12:14
3
  1. First you have to open your's project with newer version of Xcode.
  2. Right click on XXX.xib file and select "Show File Inspector."
  3. Go to Interface Builder Document.
  4. Change Development option with older version of Xcode.
0

Once I used to manage a project with XCode 5 xibs in XCode 4. I split xibs for each XCode version and made this build script that compiles xib to nib and place that nib them inside the app

#get SDK version
SDK_VERSION=$(echo $SDKROOT | sed -e 's/.*iPhone\(OS\)*\(Simulator\)*\([0-9]*.[0-9]*\).sdk/\3/')

if [ $SDK_VERSION == '7.0' ]; then
   echo 'Current SDK is 7.0'

   ibtool --compile ${TARGET_BUILD_DIR}/${TARGET_NAME}.app/output.nib ${PROJECT_DIR}/ProjectFolder/input.xib.xib 

   echo 'Copied nibs to' ${TARGET_BUILD_DIR}/${TARGET_NAME}.app
else
   echo 'Current SDK is not 7.0 (SDK is' $SDK_VERSION')'
fi
fardelejo
  • 1
  • 1
  • 1