My project runs good in Xcode 11. But when I build it in Xcode 12 gets the above error. I have been struggling for a while and no answers worked for me.
Please help
Thank you
It's quite an old question, but I was struggling with such issue for a few hours today and in my case it was related to the version of the tools that is declared in xib's document structure. To fix it, take a toolsVersion value from any newly created xib file (either in your current project, or a new one), then open failing xib with any code editor (or view its source in Xcode) and replace toolsVersion with the acquired one.
In my case the old version was 18122 and the valid one is 20034.
Old question but I ran into this the other day and wasn't really finding any direct solutions.
What appears to have worked for me was correcting the "builds for" value in Interface Builder. The xib file was from a project that supports a level of iOS several versions later than the project I was copying it into, and there were elements within the interface (like stack views) that weren't supported in the older OS. Once I changed the "builds for" value to an OS version that does support those UI elements, the problem went away (note that this subsequently required me setting up version checks in and around the files associated with the xib to only allow access if the user's device meets the minimum "builds for" value set on the xib).
If you're unsure where the "builds for" picker is:
In Xcode, select the xib file, and select the File Inspector within the Inspector pane (pane on the right hand side). Set the builds for value to an OS that supports all elements used within the xib, and see if that clears up the error.
Related
I am building an app right now and using storyboards for the user interface. Storyboards were working great until about a week ago. Suddenly, they began to give me trouble. I posted a couple of Stack Overflow question regarding issues about storyboards. I have been experiencing all of the following issues:
Actions connect as AnyObject instead of Any when connecting them from storyboard.
I receive an error unrecognized selector sent to instance 0x7fb80e92bc00 due to objects not connecting from storyboard to source code.
Unwind Segues do not work. When I try to connect one, it doesn't even show any available.
I cannot select any of my UIViewControllers from the dropdown menu under the Identity inspector which I discussed more about in this question.
Inherit module from target does not get automatically selected in Interface Builder.
Here are the following things I have tried:
Clean the build folder.
Restart Xcode.
Restart my MacBook.
Delete derived data.
Tried a different storyboard.
Deleted some of the files that were giving me trouble (which is no longer an option as all files are giving me trouble).
New issues pop up everyday and it is getting more difficult to build my app when these issues occur. Why is this happening and is there any solution available?
I am facing the same issue in Xcode beta version. It generally facing when create new file. I resolved by following steps
Remove File reference
Add file again. (If file add with "copy" suffix, delete original file from source folder remove "copy" from file name)
Now try to connect with your reference, it will work
I'm struggling with this problem for nearly half a year now with multiple XCode versions and Macs.
I can't reproduce bug steps exactly but the things go off when project has multiple targets like for Mac and iOS.
First of all XCode declines to take #if os into account and always highlight syntax only in one type of sections. E.g. if I have os(iOS) and os(OSX) somewhere it will chose only one and highlight only them.
Same goes for autocompletion. Things just not working in that type of projects.
I really dont know what to do since developmenet process turns into struggling. I dont want to split my project into multiple one, I'm happy with multi-target setup.
Is there a way to fix that?
Almost a year late.
Anyway I faced the same situation where a multi target OSX/iOS application in Xcode did not take into account the #if TARGET_OS_IPHONE conditional and failed to autocomplete method names from framework only showing the iOS variant.
Found a solution, based on this blog entry : you have to clearly state the Framework search path on each target in Build settings
Edit: This line was present in the iOS target settings. I copy/pasted it to the MacOS target in Xcode where it was automatically adjusted to the right path.
Edit 2: Loosely related but if you run in trouble with interface builder picking wrong classe files see this answer I just posted in another old thread.
I can not drag anything to the code from the storyboard. Files were in assistant editor under automatic but now there gone how do i get them back other then deleting and recreating them? Opening them up under manual it will come up but Xcode can't find the referance when dragging to the code and i get the error when naming it.
I don't know if anyone else is still having this issue, but I get it a few times a week on Xcode 6.1.1 and I usually do the following to fix it (once I have checked that there are no class name mismatches):
Clean build
Delete Derived Data (using Organiser)
Force Quit Xcode
Re-open and Build
I know this is crazy, but it continues to work for me o_O
The most common cause is a mismatch between your class name and the name registered in the identity tab of the view controller. This will happen if you for example rename your class but don't update the classname in the storyboard.
To set/check the class name, open the storyboard and click on the leftmost icon in the titlebar of your UIViewController. Then open the identity inspector in the utility pane (right side) and double check the name given as the custom class.
The issue is due to not completion of indexing - so there are few alternatives, that you can try for-
Way 01 : Check if indexing is showing in processes - then let it complete. Then, close the editor and reopen it
Way 02 : Just perform the clean action. It will start showing appropriate Viewcontrollers.
Way 03 : This is the most effective way - Just perform "Build" and then restart editor - it will surely going to work.
I had the same problem, and I managed to solve it by selecting the correct Target on the File Inspector of both files (Swift and XIB in my case, you can check the file inspector in the storyboard).
It can happen if your project has a lot of targets (mine had a few, the file was checked on the wrong one).
You'll want to turn XCode indexing 'on' and set the Assistant editor to “Automatic”. This helped in my situation when the other suggested answers didn't. Details on turning on indexing at Stopping xcode from indexing
I just deleted build folder completely.And it works for me!
I recently became interested in mobile app development and want to take my coding experience from elec. engring to the iphone. Im having trouble though. I am trying to compile my first app onto my phone (got it to run perfectly on the iOS simulator last night). However, upon compiling i get the following error:"Interface Builder XIB Compiler Error: Interface Builder could not open the document "xxx.xib" because it does not exist"
I've tried going into my target and setting Main Interface to xxx.xib and I still get the same error on both iPhone and iOS simulation. I've tried setting my interface to Xcode 4.6 and messing with the builds and views, still have the same issue. I built it from scratch - same issue.
All help appreciated. I know the default is building with story board, but I am following a book I am happy with and I want to go through it with the .xib because thats what the book uses. Thanks -
Select your project (blue icon) in the project navigator then choose:
Build Phases > Copy Bundle Resources
Make sure your xib file is on the list. You can add it by clicking the plus (+) icon on the lower left.
UPDATE:
Consider opening a new project as a sanity check. Change the background color and verify that it runs in the simulator. If it does then this will point to a project settings issue rather than an installation problem.
You may also want to look at the following walkthrough by Apple. Hopefully following the steps will help illustrate anything you might be missing.
Apple also has a latest tutorial that I recommend you walkthrough. After completing please let me know if you are continuing to have this problem. The number of potential problems is greater than simply walking through the 15 min tutorial.
My problem is that I have storyboard which support multiple languages (6). Since app was created before iOS6 I have 6 versions of storyboard.
Now UI has been redesign a bit (mostly order of views has been changed) and I did changes only in English version.
Now how to propagate those changes to other languages with minimum effort?
I've noticed that since iOS6 and XCode 4.5 I can get rid of multiple storyboards and just provide translated strings for other languages.
I've found this answer and this tutorial, but this refers only to new projects nothing about how to do this for old big projects.
Ok I've got it!
Enable "Use Base internationalization" for you project (just like in this answer). XCode will ask to select base language (probably you will select English).
Select root storyboard (the root version which contains versions for all languges) in project navigator.
Then in "view/Utilities/File inspector":
For each language change option from "Interface Builder Cocoa Touch Storyboard" to "Localizable Strings":
XCode will ask to confirm conversion.
Before test UNINSTALL APPLICATION FROM DEVICE. Simple run from XCode will not remove old storyboard files from device and you can experience some strange problems (since I did some changes in UI I've experienced some unhandled exceptions).
Verify that everything works and everything is translated properly. Add missing translation if necessary.
This procedure did work for me, with this big hiccup described in step NR 4.