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

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.

Just open Storyboard in XCode 5, into right panel and "File Inspector" tab do:
edit your "Interface Builder Document" like follow:
Save it and open in previous XCode.

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

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.

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,

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.

First you have to open your's project with newer version of Xcode.
Right click on XXX.xib file and select "Show File Inspector."
Go to Interface Builder Document.
Change Development option with older version of Xcode.

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

Related

Finding and deleting Xcode beta marker

I have a new version of an app to submit and accidentally opened it with Xcode 11 (latest beta); now Apple reject a binary built with non-beta Xcode 10 (the message warning that builds can only be submitted from non-beta Xcode).
I'm guessing that somewhere in my project is a marker identifying the build erroneously as from Xcode 11.
I'm hoping someone can let me know how to remove this pointer so I can submit my app.
Thanks
1 - Make sure all of your projects (including pods) is compatible with one stable Xcode.
2 - In organizer window
Right click on the archive on select show in finder
Right click on archive and select show package contents
Head to de product -> application
Right click on YourApp.app and select show package contents
Open info.plist
Change the value of DTXcodeBuild to 10E1001 (The version of older stable Xcode)
Change the value of BuildMachineOSBuild to 18D42

Interface builder storyboard compiler error Xcode

I downloaded Xcode and am getting "Interface builder Storyboard Compiler Error" when I try and run any project.
So far to troubleshoot this I have(based off any similar threads):
-cleaned the file
-created a new blank file (which still gives the compiler error message)
-uninstalled and reinstalled Xcode (Version 8.2.1)
-tried installing Xcode 8.3 beta 5 (still gives me the same error)
so far nothing has fixed this error.
Also I'm up to date on OS, running macOS Sierra version 10.12.3
I am learning swift for work and am hoping to get this figured out soon.
Thank you!
Xcode 8.2.1:
quit Xcode
delete .xcuserdatad folder inside xcuserdata of .xcworkspace(if using Cocoapods) or .xcodeproj
reopen Xcode, clean project and clean build folder (Under Product option)
That should be ok!
I had the same problem while trying to archive my app for the app store. I tried twice and same problem occurs.
Then i deleted the derived data, cleaned the project and restarted Xcode - THAT FIXED it.
Hopefully this will help someone else
I Solved the problem by cleaning the build folder.
Just use cmd + option + shift + k and then build the project by using cmd + B and hopefully solve the problem.
I was having this error for xCode 9.
An .xib file was creating the error.
What I did was,
removed .xib file
added it back to the project
cleaned and built the project
That solved my problem.
I also ran into this with XCode 9 Beta - 2, the quick nuke from orbit didn't fix it. Just check out the Log file it points you to and you can at least patch the offending issue, even if it a bug on Apple's end. For me, the TabBar didn't like an icon image, removed it for now and it Built fine.
I'll try replacing it yet with another image. Apparently it doesn't like its own System-provided Images.
Exception name: NSInvalidArgumentException
Exception reason: System-provided UIImage instances cannot be encoded
in NIBs - raised for instance '<UIImage: 0x7fd377eb4510>, {18, 20}'
None of the above suggestions worked for me. After further research I found that I had dragged a segue (popover) from a button inside of a tableview cell.
This is not allowed, as the touch anchor screen location is dynamic while the table scrolls.
I fixed the problem by anchoring the whole tableview instead and programmatically altering the popover arrow placement to be in line with the cell's button.
I just had the same problem.
After systematically removing objects from the xib I found that a button which was disabled and hidden created the internal error. After removing the button it works. (I tried to set the button back to normal : visible and enabled but that was not sifficient).
Hope that help you.
I have filed a bug report.
I have solved this issue by following below steps:
1. cmd + shift + k
2. cmd + option + shift + k
3. Restart Xcode
4. Restart you mac.
Hope this will also help you. Thanks!
I had this same error after updating to xcode 9.4. After doing a Product -> Clean and then Product -> Build still no luck. Then Done a clean again and restarted. After the reboot the build succeeded.
I use Xcode 9.4.1 and Xcode 10 beta 4 on macOS 10.14 beta 4. I opened the project that threw this error in both versions of Xcode.
While removing different files from bundle resources, I also got several other errors, such as "Interface builder XIB Compiler Error" and "Failed to launch IBCocoaTouchImageCatalogTool via CoreSimulator spawn".
After trying every other solution I could find, what finally worked for me is reinstalling Xcode 9.4.1, reopening the project and cleaning the project/build folder.
I speculate that this happened because there were times when both Xcode versions were open simultaneously. The two versions use common files and the simultaneous usage possibly caused an internal inconsistency in the rendering of Interface Builder.
I had this problem too, in Xcode 11;
In my case it happens after solving conflicts on .xcodeproject during merging code.
I followed below steps:
Remove storyboard from reference of project.
Select MyProject.xcodeproj and show content of that, then open
project.pbxproj by Xcode or text.
Search for storyboard name and removed all line contains that names.
Build project
Add storyboard to project.
Build project again.

Migrate xib file to Xcode 4.4

This should be an easy one, but surprisingly I could not find any information about it being or not being possible to do.
I have some .xib files created in older versions of Xcode/Interface Builder and I would like to use Xcode 4.4's new features but so far I've only been able to achieve this by deleting the older .xib files and creating new ones from scratch.
You may need to update the older xib files' development target. Select the xib file from the project navigator and open the file inspector. In the file inspector's Interface Builder Document section is a Development menu. Try updating the development target to Xcode 4.4 and see if that allows you to take advantage of the new Xcode 4.4 features.
If updating the development target doesn't work, you'll have to provide some more information about the problems you're having and the features you haven't been able to access.

How to make an IPA on XCode 4.3?

I have a Mac OS X Lion setup with XCode 4.3. I am not a registered Apple developer.
I told, via the plist files: /Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist and
/Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist, XCode not to require codesigning.
I then compiled my project, just a basic iPhone app project, it ran well in simulator. I could build and archive it, then sign it using a self-created certificate and the archive appeared in the Organizer.
Nothing strange for the moment, but there comes the problem: I have no "Share" button in the organizer. I absolutely need to make an IPA file out of my project if I want it to work under an iPhone as it won't accept xcarchive files. I only get the "Validate" and "Distribute" buttons which both require to be a registered Apple developer. But, no "Share" button which enables building an IPA... for free.
I have gone through XCode settings but nothing seemed to help me there. Even the documentation says a Share button is available in XCode 4.3, so my question is: Why don't I get the possibility to make an IPA? IS there any workaround to get this Share button or make an IPA out of the xcarchive via any command line or whatever?
Here's how you can make an IPA in XCode 4.3:
To Disable Code Signing:
Go to /Applications.
Right click on XCode and select 'Show Package Contents'.
Copy Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist to your desktop. (Make sure to actually copy and paste. No drag and drop)
Open it and under DefaultProperties set CODE_SIGNING_REQUIRED to NO.
Copy it back and replace the original file.
Restart XCode.
Open your project.
In Project Navigator select your project and open Build Settings section of your porject (and not any particular target)
Under Code Signing find Code Signing Identity and for both Debug and Release modes set Any iOS SKD to Don't Code Sign.
Now you should be able to build your project without any errors.
To make an IPA:
In 'Project Navigator' select Products
Right click on [NameOfYourProject].app and select 'Show in Finder'.
Create a folder and name it Payload
Move [NameOfYourProject].app to Payload.
Compress Payload and rename it to [NameOfYourProject].ipa
You should be able to get an IPA by clicking 'Distribute...' in Organizer->Archives, and choosing to 'Save for Enterprise or Ad-Hoc Deployment'.
Beginning iOs 5.1 Apple moved their files from /Developer/... to XCode->Show Package Content
In order to export codesign_allocate correctly run this line on your Mac terminal :
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate

Can't create iPad XIB with Xcode 4

Alright, I have a problem on my hands. I'm trying to convert my project to a universal app for the iPhone and the iPad. I'm trying to make iPad-specific versions of my XIB files. As it's not possible to Create iPad version using autoresizing masks in Xcode 4, I assumed I'd just be able to pop my XIB into Xcode 3's version of IB, and let that do the magic. No dice. Here's the error I get when i try to open the XIB file in IB:
To be honest I don't know where to proceed from here. I guess I could just resize my views manually, but that's quite tedious and I don't really have the time to be doing that. Any ideas?
Alright, I figured out a rather convoluted workaround.
First of all, duplicate your original project and then select your project info. Right-click on your target, and select "Duplicate".
Xcode will then pop up this message. Select "Duplicate and Transition to iPad".
Now Xcode converts the XIB files for you, and presents you with an iPad resources folder.
Now open these XIB files in the Finder, and append ~ipad after the file name.
After doing so, copy these XIB files back into your original project, and then turn your project into a universal project by selecting from the dropdown in your target settings.
And you're done. I found that really convoluted, and I'm hoping Apple can fix this huge usability problem soon.
This should not happen. One way to fix this problem would be t completely remove the Xcode 4 Installation and re install it from scratch . And then re install it.
Use the following command to uninstall and re install Xcode 4
sudo [xcode-path]/Library/uninstall-devtools --mode=all
PS: If you are creating projects in Xcode 4 that you also want to open in Xcode 3 make sure you keep Document Versioning section to Interface Builder 3.1

Resources