iOS designer not rendering storyboard - ios

In the Xamarin.IOS editor I get this error:
"There was a problem parsing the XML in this document"
System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Design.ProxiedView.set_UseSafeArea (System.Boolean value) [0x00001] in /Users/vsts/agent/2.154.3/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/ProxiedView.cs:944
at MonoTouch.Design.ProxiedViewController.UpdateLayoutGuides (MonoTouch.Design.Catalog utilityCatalog, MonoTouch.Design.IosDocument rootModel) [0x002ac] in /Users/vsts/agent/2.154.3/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/ProxiedViewController.cs:238
at MonoTouch.Design.Storyboard.UpdateLayoutGuides (MonoTouch.Design.Catalog utilityCatalog) [0x00017] in /Users/vsts/agent/2.154.3/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Shared/Storyboard.cs:132
at MonoTouch.Design.Client.IPhoneDesignerSession.LoadXml (System.Func`1[TResult] getDoc, System.Boolean shouldTryUpgrade, System.String fileName) [0x00310] in /Users/vsts/agent/2.154.3/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Client/IPhoneDesignerSession.cs:466
I tried disabling things and retracing every step I made doing the storyboard, the only thing that half worked was disabling autolayout, but it destroyed my layout.
The thing is that it works perfect in the app and xcode but in the VS iOS designer it doesn't work, and I need it to add the ids of the components to use them my ViewController, in my project it's the only way to add ids.
I´m lost, if you need any extra info ask me, I pasted the important (or so I think) part of the logs, they were too long.
This is the iPad version of a storyboard that works perfectly, it was based of that storyboard (copied and pasted then edited to fit with iPad)
This is the storyboard: https://pastebin.com/QAHEBne0

The problem with your file was that somehow you have constraints related with the safeArea but it was not turn on in the file.
I fix it when I open the file in my Xcode and just turn in on(check the image)
the result is useSafeAreas="YES" added to document tag on the second row in your xml
Please, check your constraints carefully it is possible some of them to be broken or deleted.

Related

uiview deleted from storyboard is still showing

I have a very strange behavior in my ios app, if I go to the storyboard and delete the UIImageView object and then run the simulator it still show the image.
Any ideas?
I know why you don´t believe me, I didn´t beleive it either when I saw it, but I just found what(not why) was hapening: the problem was that I messed with the main storyboard configured in the project->info, somehow it was calling the old storyboard and i say somehow because there was no file with that name, it was not enough to change the property to the actual storyboard file, I needed to create a new one.

Views in storyboard appears empty

Yesterday, after not working on this project for some time, I booted up my mac again to continue this iOS project. Unfortunately, all of the sudden, after making a view fixed after making it freeform, Xcode gave me a "internal error. Please file a bug report and include /var/.........". I cleaned the project, but now every view appears to be empty, while there are objects in it. See the screenshot below.
Afterwards, I have updated to Xcode 7.2 where the problem still persists within this project. Other projects work correctly.
Better yet, whenever I place a new object, for example the picker view, it shows perfectly.
Thanks for taking the time to answer my problem
Regards,
Riekelt
Try this , I have solved same problem by this way.....
Storyboard -> Attribute inspector -> simulator size -> Fixed
Hope you would have fixed it already. I had also faced the same problem and solved it with following fix.
Changing size classes back and forth. Storyboard -> File inspector -> Interface Builder Document -> Use Size Classes(reverting the size class in storyboard to the size class which we designed our views originally).

The document "Main.storyboard" could not be be opened

I'm using Git and we are 2 people coding together. I pulled my friend's code, run it and it worked as it should be. Then I merged our parts and cleaned conflicts (almost all of them were in storyboard). Since i'm doing this merge process for a while, i'm not all stranger for these details.
However, when i run the merged version of code, i get the error:
The document "Main.storyboard" could not be opened. The operation
couldn’t be completed. (com.apple.InterfaceBuilder error -1.)
I can't open storyboard as interface builder either. When i try it, I get the same error. I read previous post about this error but as I mentioned, I can open and run both versions of code in my XCode before merge. Thus, there is not a font or attributed string problem.
What may be the problem?
I got this issue, after I solve the conflicts which is merged by svn.
I could only see the source code of my storyboard, I could not open my storyboard as interface builder. So, after my struggle,
1)I delete the topside space line in my storyboard source code
2)and close my Xcode and simulator
3)restart my project
it becomes regular, oops, the space line on the source code will affect our storyboard !
there are conflicts in Storyboard. You can take last working code of storyboard from github. select storyboard select version editor and copy last working storyboard and replace xml with existing xml.
I guess your storyboard still have confliction.View your storyborad as source code, then fix all conflictions. After all, open it again as Interface builder
For me the only thing that worked was to create a new storyboard file, open the old and the new storyboards as source code, and copy the xml from the old to the new storyboard. I didn't take the whole xml, just the scope of the <scenes> </scenes>
I had to create a new Storyboard file. Then cut and paste the "scenes" tags from the old and put into the new. I then had to delete the old Storyboard from the project in order for the project to build successfully!
I guess the problem is that storyboards don't merge very well, I think it is better to init your UI from code so there will be no troubles during merges. Anyway you should try to rollback and merge it again.
As other mentioned, there are likely merge conflicts in the storyboard file.
If you can't easily solve the conflict by either picking --ours or --theirs, you will have to perform the merge manually in the storyboard file.
What I do is open in in a text editor (e.g., TextEdit.app - but make sure it opens documents as plain text, in Preferences).
Then, locate any occurrence of the git conflict markers (or a portion thereof, e.g., "<<<<<"), and pick the code fragment that you want to leave (and remove the other, of course).
EDIT: As Cong Tran mentioned (and I forgot), you can open storyboards as source code from within Xcode itself (see his answer).
Fast way to fix
Copy the storyboard Id shown on the error prompt window
Right click on your storyboard
Choose Open as => Source Code
Search the id and delete one of the duplicateID and you are done!
i would suggest , right click on any of the files and click on finder then you will have what you need and drag and drop

Xcode crash on opening storyboard

I am developing an app for iOS with Xamarin. Lately, I haven't been able to access my storyboard file in Xcode or compile my app anymore because Xcode crashes right away when opening the .storyboard file.
The error message is the following:
ASSERTION FAILURE <br>
Details: Creating an out of band arbitration unit with a view (<IBUITableViewCell: 0x7fa88d13a5d0>) as the root under another view (<IBUITableView: 0x7fa88cf000e0>) is not yet implemented.<br>The view would need to be in two arbitration units, the one above for positioning constraints, and the root of the one below for sizing constraints. <br>But then that means that subviews cannot have constraints that affect the size of the view, so the view must have ibExternalTranslatesAutoresizingMaskIntoConstraints set to YES.
<br>Object: <IBUITableViewCell: 0x7fa88d13a5d0>
<br>Method: -ibArbitrationUnitWasCreatedWithReceiverAsRootUnderParent:
I tried rebasing my storyboard to the last version that worked (the one the app was submitted to the app store) and weirdly, even that version didn't work.
My plan was to manually remove and every view controller and add them one by one to figure out where the error is.
However I don't understand why XCode crashes when opening the storyboard and not just shows me exactly where the error in my xml is.
So if anyone has encountered this problem before and has a better way to fix it than to manually do it, I would really appreciate any help.
ibExternalTranslatesAutoresizingMaskIntoConstraints needs to be YES
Sounds like the Storyboard was created with an older Xamarin.iOS that introduce this issue.
The fastest solution is to open the storyboard in vi (or Xcode / View As Source, or another text editor of your choice, and replace all translatesAutoresizingMaskIntoConstraints="NO" with "".
Save the file, re-open it in the Storyboard editor and fix your contraints.

Storyboard crashes Xcode when opened

Whenever I attempt to open up my storyboard, Xcode crashes with the following error report
The funny thing is, the app works fine in the simulator and builds without errors. What is causing this crash? I see two possible crashes:
Exception reason: UITableView dataSource is not set
, but that shouldn't make the storyboard crash right?
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
Which doesn't give much information at all.
I have been using a storyboard with Xcode 5 for some time, so the question does not appear to be related to moving from Xcode 4 to 5. I can open the storyboard as XML and I can open my iPhone storyboard just fine.
If you are using git, I would recommend reverting to a time before this problem started.
If you are not using git, and you are absolutely sure you did not edit the xml for the storyboard then I would say:
1)find the storyboard file using the finder.
2)copy it to your desktop.
3)go back to Xcode and delete the storyboard from your project, select "move to trash". 4)re-import the storyboard file into your project.
Ive had similar problems with Xcode 5 and either reverting using git or the steps above usually get me back up and running.
Exception reason: UITableView dataSource is not set
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
The errors described above lead me to think that one if not all viewcontroller(s) for the items listed above lost their connectivity to viewcontroller.h / viewcontroller.m files. I would make sure you have everything wired up correctly, and you can check this by making sure the items in your viewcontroller have a circle in the gutter (next to the line numbers) that is filled in (solid) if the circle is not filled in then it means your items are not wired up to your viewcontroller. I would post a picture of your .h / .m file of your viewcontroller so we can further investigate.
I ended up copying each view controller scene (in XML) into a new storyboard. Some view controllers could not be copied without the storyboard crashing so I had to recreate about 4 of them, but by and large I got the majority of my work back.
What you need to do is reopen the project again in Xcode 5 and then go to the storyboard. Then at the right side choose for "Identity and type" and then set "opens in" to Xcode 4.6 to be able to open it in Xcode 4.6. And disable auto layout, somehow when you open it in xcode 5 it asks you to update it, I think you did that without a thought, happened to me as well :)

Resources