Xcode crashes when dragging UIElement to model - ios

When I attempt to drag a UIButton to my ViewController.m (control + drag), Xcode crashes. I have tried unchecking the "Use Autolayout" box, but I am still having the same issue. I am using OS X 10.9.4 and Xcode 5.1.1. Any ideas?

That sounds awful and it should not be happening. However, there is an easy solution: do not do that. Control-dragging from the Interface Builder canvas to your code is completely unnecessary; you can do everything you need to entirely by working in the code and in IB separately.
I realize that for you this is not a solution ("why am I crashing?") but rather a workaround, but it's a perfectly good workaround and will allow you to move on with your work.

I just had a similar problem Ctrl-Dragging from a map view inside a prototype cell to the view controller that the prototype cell subclassed from. I mistakenly had an old outlet reference left on the map view, and after removing and saving the change, Xcode no longer repeated the crash.

Do you have more than one version of XCode on your machine? I had the same issue and think there was a conflict because I had XCode 5 and 6 installed. I deleted 5 with appCleaner and got rid of all the extra files. Everything was working after that.
If you only have XCode 5, I would try a clean install.

Related

Issue in loading StoryBoard [duplicate]

I have updated by Xcode to Xcode 11 Beta and have updated the build settings from iOS 12.2 to iOS 13. Everything is working perfectly but the viewcontrollers in Storyboard appear black. The components of the viewcontrollers are present but it is difficult to preview due to the black screens
Had this same issue, eventually tracked it down by cut-pasting elements from the black screen to a brand new view controller and see which ones cause the new one to have the same error, or caused the old one to render.
After fixing it, the diff ended up being a background image on a specific UIButton.
I found that after updating to Xcode 11 if one element has an issue, it breaks the whole storyboard like your screenshot.
I had this issue last night. My UITableView was expanding too far out of the screen on the right hand side. I dragged it back into the bounds of the UIViewController parent and updated the right hand side constraint to be 0.
So check if anything goes beyond the UIViewController boundary that shouldn't.
In Xcode 12.4
After trying lots of thing, finally i resolved my issue
First close your project.
just goto finder -> Application -> Xcode -> get info -> uncheck open using Rosetta
Now, simply open your project.
Just delete any constrain in that viewcontroller and then undo the change.
Check the values for the cell heights. In opening an older project, the row height (in the TableView itself) was 0. Changing it to a positive value or deleting the value (so it defaults to automatic) fixed the issue for me.
I had the same issue, here are the steps I followed.
Clear constraints, for my case the source was from UITableView, and make sure constraints are attached to safearea not superview.
From the toolbar on the top, go to Editor > Canvas > Layout Rectangle. It is very important to repeat this step 3 times.
Once finished, quit XCode and reopen it again and everything should be fixed. I've noticed this happens when I'm switching views for different devices 8, 11, 4s.
I don't know exactly what the problem was, but I was able to solve it with the following steps.
Run 'pod install' to install all cocoapods dependencies
In Xcode: Product -> Clean Build Folder
Restart Xcode and run the project

storyboard refresh issue Xcode

I have an issue of storyboard refresh all views, when I change constraints it cannot be change in storyboard but change in simulator and device.
But when I reopen my project then it refresh.I tried below step but nothing happened
Select storyboard->editor-> refresh all views
and also automatically refresh already checked.
Is this bug of Xcode 9.3?
Here I attach image:-
but in simulator look like perfect below image:-
Thanks you.
I have also gone through this strange issue. I believe it creates if your project becomes so much heavy and lot of storyboards used. Therefore using Xib instead of Storyboard is the good option.
If you restart xcode and reopen your project then you can see your view as expected with updated constraint.
I got the answer it's happened due to IBDesignable in my custom library class.If I remove all IBDesignable it's work fine.
Thank you.

XIB hangs a lot, Changing View As Device fixes

I made a project on Xcode 7.3, but after the release of xcode 8 I had to move onto that as I upgraded my project from swift 2.2 to swift 2.3 too, but im having a very weird problem. When I open my XIB file, it makes xcode very very slow almost crawling, I got 3 ways to fix the problem,
1) Take a new View from toolbar and make the previous view the subview of new view and apply contraints and it will stop hanging.
2) View the xib as source code, insert random spaces at the end of lines (Let xcode know that you edited file whatever it is), save it and come back, it will occasionally fix the problem but didnt work everytime.
3) when XIB is hanging, change the device in View as and it will start working properly untill you go to another XIB and come back.
This is happening in Xcode 8.1, does anyone know what can be the issue ?

Autoresizing issue in Xcode 8

=== EDIT ========
This issue is now solved in Xcode 8.1. I have checked.
================
I don't know auto-layout properly. So, I am using autoresizing option in my all apps and it's fine for me. I am able to fulfill my all requirements by this without any issue.
Now in Xcode 8, I have migrated my old swift project to swift 3. Now issue arises.
See in image, I have set Autoresizing, and its working fine without issue in all devices until now and this project is live in AppStore, so that I can't show the UI or storyboard.
Now I have to do some update in project. So I am working in Xcode 8 now. But my autoresizing not working properly, as all the controls are come in center and UI is messed up.
And the issue persists in device also. I have checked in simulator and device as well. But problem is there also. Any suggestion and help will be appreciated. Thanks in advance.
EDIT:
Yesterday there is issue in runtime only, But Today storyboard also changed views like this image
Which means the whole UI design is messed up. This is weird.
Facing same issue. As a my point of view this problem is occurred when we use autoresizing and set only inner autoresizingMask to any view controller. Like,
If we use also boundary autoresizingMask at that time not facing this issue. Like,
I don't know this is actual bug of xcode 8 or remove this functionality in xcode 8.
So, Finally my suggestion is that we need to use auto layout in xcode 8.
Please try to uncheck autoresizing from xib or storyboard. And inviewDidLoad set [_scrollView setAutoresizesSubviews:YES];
Try it if this solve your problem
Edit: In case of storyboard uncheck Resize view from NIB option.
I'm not sure about storyboards but I've found a temporary solution for xib files. In Utilities panel (right hand panel) select File Inspector tab. Under Interface Builder Document section, select the file to open in "XCode 7.x". It will ask you to confirm that you do not want to use XCode 8 features, save the file and close it.
Xcode 8 beta 2 solved this problem!! I already checkeded now!
I had a similar issue for scrollView in Xcode8
I have an one solution to work with scrollView
First take a simple UIView and add all component which you want add to in scrollView and give that component to autoSizing
And also take one scrollView and programmatically set view frame and also set scrollView contentSize and add your view into scrollView
like wise, in my case I added this code in viewDidLoad for swift project
// add view to scrollview
self.scrollObjForNextAppointment.contentSize = CGSize(width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.viewForScrollContent.frame = CGRect(x:0,y:0,width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.scrollObjForNextAppointment.addSubview(self.viewForScrollContent)
it's work for me, Thanks!
Solved by unchecking "Auto Resize Subviews" to ScrollView
Update the issue seems to have been fixed in Xcode 8.1
Having the same issue and I've found that the offender here is the UIScrollView element. Just move everything outside of your scroller and you will see that everything works just fine, like before.
Which means one possible workaround would be to place your scrollable content in an ordinary UIView, then replacing it with UIScrollView at run time, programmatically.
A moderator kindly deleted my answer here as a duplicate, so see my answer at:
Autoresizing under iOS 10 doesn't work
In response to max, yes, resizing a bunch of subviews can be a pain. That's why I suggested adding a single "content view" to the scroll view and moving all of your existing subviews inside of that view. Autosize the subviews inside of the content view just as you did with the scrollview, and autosize the content view to the scrollview.
It's that content view that you're then resizing inside viewDidLayoutSubviews.
And again, the "content view" inside of the scrollview construct is pretty much the standard way to get auto-sizing scroll views using autolayout, so it should be considered a best practice.
That method is described here...
https://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/
My method seems a little convoluted, but I was able to patch up a storyboard with about a dozen scenes and Vc's in about 15 minutes. It would have taken much, much, much longer to rebuild everything using auto layout.
Apple just came out with XCode 8.2, which fixes this problem for me. I have been using XCode 7.3.1 for my interface design parallel to 8.1, but I can now use 8.2 without any problems.
The storyboard gets updated with widths and height of frames though, to accommodate the new 'View as:' functionality. Though it doesn't seem to affect running on device/simulator.
Curiously, the bugfix it is not noted in the XCode 8.2 release notes.
Original answer here

In xcode 6.1, interface builder deleting ui elements

I have a view with some tableviews and some collection views and also some buttons and labels.
I'm not sure if this is new with Xcode 6.1 because I have not worked on the ui aspect of this project for some time. However, when I try to resize just about anything in the view, my tableviews and collection views, and possibly some other elements I am not noticing, get deleted. Specifically, it seems their frame or rect propertied get deleted.
To be clear, this only occurs when I attempt to resize the element by dragging the sides in interface builder. If I resize them by changing the numbers directly either in the IB sidebar or in the xml, this does not happen.
I'm wondering if this is a bug in Xcode or if I have done something to cause this behavior which I can change.
Thanks!
I acheived a fix, at least for this project by turning off auto layout in "show the file inspector" -> "interface builder document"
I have never used this feature in the past so I do not know if it was on in the past but I am wondering if the new Xcode version turns it on by default where the others left it off.
It may also be possible that it has always been on but there is a bug in the feature in the new version.
This fixed the issue for me, at least in this particular project and at least for now. I hope others find this useful.
From here it looks like a bug in Xcode 6.1.
I created a clean project and the behaviour is the same on my machine:
https://github.com/nasht/Xcode6ConstraintTest.git
Resizing one view makes others disappear. Changing a layout constraint from a = to <= or >= also seems to do it.
I've raised a bug with Apple. Suggest you do the same.
workaround: You can install xcode 6.01 and use interface builder from there. You can still compile and run your code using xcode 6.1 if you're relying on xcode 6.1 specific features. (you'll need to rename your xcode.app so you can run both instances. ) It's ugly, but it works.
I found that it's fixed on the next version of xcode (6.1.1)
same problem, yosemit and xocde 6.1. I can resize some view only if i disable autolayout.
I think I ran into this 'problem'. I believe this was because one of the constraints I had was not setup correctly.
What OS X Version are you on? I updated to Yosemite today and 6.1 along with it. When I would resize a label my other elements were not getting deleted but instead getting resized and repositioned. The width / height would change to 0,0 and the x / y would change to 0,0 as well.
I was noticing other issues with Yosemite so went ahead and did a time capsule restore back to Mavericks and Xcode 6.0
I had the same problem in universal app; iphone works fine and the ipad doesnt work.
I'm using xCode 6.1 and OSX Yosemite
My app supports iOS7 and iOS8 and i had the same problem on iOS7 on iPad version only
Fix:
So i fixed it by setting Simulated Metrics in interface builder by
Size = iPad Full Screen and Orientation by Landscape or Portrait
I have got the same kind of problem with Xcode 6.1 and Yosemite :
I have created a view that I have added to the main view, so it appears like a sub view in the View Controller Scene.
Then I resize this subview to 320 x 568. My program works. It corresponds to the program dropit of Stanford CS193P Lecture 9.
I save the project, close it and reopen it : the subview has its width and height set to 0 !
I tried to open the project dropit of Lecture 8 that is quite the same, which was working before (I think in Xcode 6) and same problem ! First I thought that tapping (related to the subview) was not working but found out that tapping was not working because I was tapping on a subview which has its width and height set to 0 !
I have reset the size class wCompact hAny to which all the UIElements are added. and got corrected.

Resources