Xcode error while openning file - ios

Today i tried to open .xcworkspace file on my project but i got some error like this
Process: Xcode [740]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 6.2 (6776)
Build Info: IDEFrameworks-6776000000000000~11
App Item ID: 497799835
App External ID: 811890240
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [740]
User ID: 501
Date/Time: 2015-04-07 13:45:47.945 +0700
OS Version: Mac OS X 10.10.2 (14C1514)
Report Version: 11
Anonymous UUID: 97BA685B-5788-8D8E-FA49-9E2A21F38165
Time Awake Since Boot: 7300 seconds
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
DVTUndoManager for delegate:<IBStoryboardDocument 0x7f7f5cb6a200>
ProductBuildVersion: 6C131e
UNCAUGHT EXCEPTION (NSInternalInconsistencyException): enableUndoRegistration: IBDocumentUndoManager 0x7f7f6616fe50 is in invalid state, enableUndoRegistration may only be invoked with matching call to disableUndoRegistration
UserInfo: (null)
Hints:
0: DVTUndoManager for delegate:<IBStoryboardDocument: 0x7f7f5cb6a200>
I also reinstalled xcode again and clear catch but it didn't work out.
Anyone know how to fix this?
Thanks!

in his case, open with right Click on .xcworkspace * & click on - Show package Content & then Remove unnecessary things from that opened folder & then try to open again .xcworkspace, you will successfully open it.

If above answer did not fix your issue as it did not in my case.
Follow the below steps to fix this issue,(Note:- this will have the Autolayout issues, which you can fix easily)
Edit your storyboard as Source code.
Locate useAutolayout="YES", change its value to useAutolayout="NO" and save the file.
Now open the Storyboard in Interface Builder mode.
You will be shown a pop up dialog with message "The document "Main.storyboard" had xx internal inconsistencies that were found and repaired". click on show details and copy and save the "contrain ids(object ID)" in different file.
"This constraint is not in the referencing constraints for its first item []: object ID Fo7-pW-aKi
This constraint's [object ID ElL-p9-pfY] second item is not in the document
This constraint's [object ID FQa-9e-EhA] second item is not in the document
This constraint is not in the referencing constraints for its first item []: object ID WPb-Rv-3fE
This constraint's [object ID 1oW-wk-Zzu] second item is not in the document
This constraint is not in the referencing constraints for its first item []: object ID 5Px-Ng-H66
This constraint is not in the referencing constraints for its first item []: object ID iKL-sX-B40
This constraint's [object ID 6EU-Hv-AiV] second item is not in the document
This constraint's [object ID ElL-p9-pfY] second item is not in the document
This constraint's [object ID FQa-9e-EhA] second item is not in the document
"
Click on "OK" button.
The storyboard is loaded successfully.
7.Now again open the storyboard in Source code mode. now find and delete all the "contrain ids(object ID)"(saved in step 4) and then save the file.
Now open the Storyboard in in Interface Builder mode. it opens successfully without any issue but in locked mode(u won't be able to modify anything)
To unlock storyboard choose a locking level from the Editor > Localization Locking menu and choose Reset Locking Controls.this will unlock the storyboard.
Fix some of the auto-layout issues and you good to go.

Related

iOS App is stuck at launch screen while Console showing: Attempting to create a breadcrumb action for a scene handle which already has one?

1.After downloading my app from TestFlight and then click it, or run from Xcode directly, the app is stuck on launch screen and cannot continue.
2.When connected with macOS, from the Console we can see some possibly related error in SpringBoard process:
Attempting to create a breadcrumb action for a scene handle which already has one (sceneID:#myAppName#-default). Are you trying to active an app that's already active?
...
[Main] dispatch event:
<SBMainTransitionSwitcherModifierEvent: 0x2837d7dc0; type: MainTransition; transitionID: xxx; phase: Complete; animated: YES; fromAppLayout: 0x0; toAppLayout: <SBAppLayout: 0x281500e80; primary: #myAppName#; environment: main>; fromEnvironmentMode: home-screen; toEnvironmentMode: application; pendingTermination: {(
)}>
The "pendingTermination: {()}" in this log does not appear when app can be launched normally.
And now we cannot see any logs in my app’s process.
3.Then when I lock the screen and unlock it, the iPhone shows nothing but a black background, and I cannot use my iPhone as usual. Here is the logs in the Console:
3.1 Lock screen:
[sceneID:#myAppName#-default] Setting deactivation reasons to: 'appSwitcher, systemAnimation' for reason: updateAllScenesForBand - Assertion added.
[sceneID:#myAppName#-default] Setting deactivation reasons to: 'appSwitcher' for reason: updateAllScenesForBand - Assertion removed.
Invalidating assertion 32-60-106090 (target:[application<#myAppName#>:7754](UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default)) from originator [daemon<com.apple.SpringBoard>:60]
Calculated state for application<#myAppName#>: none (role: UserInteractiveNonFocal)
3.2 Unlock screen:
Acquiring assertion targeting [application<#myAppName#>:7754](UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default) from originator [daemon<com.apple.SpringBoard>:60] with description <RBSAssertionDescriptor| "injecting inherited from "UIScene:com.apple.frontboard.systemappservices::com.apple.springboard" to 7754<UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default>" ID:32-60-106093 target:7754<UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default> attributes:[
<RBSHereditaryGrant| endowmentNamespace:com.apple.boardservices.endpoint-injection UIScene:com.apple.frontboard.systemappservices::com.apple.springboard>,
<RBSHereditaryGrant| endowmentNamespace:com.apple.frontboard.visibility UIScene:com.apple.frontboard.systemappservices::com.apple.springboard>
]>
Assertion 32-60-106093 (target:[application<#myAppName#>:7754](UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default)) will be created as active
Calculated state for application<#myAppName#>: none (role: UserInteractiveNonFocal)
Finished acquiring assertion 32-60-106093 (target:[application<#myAppName#>:7754](UIScene:com.apple.frontboard.systemappservices::sceneID%3A#myAppName#-default))
[sceneID:#myAppName#-default] Setting deactivation reasons to: 'appSwitcher, systemAnimation' for reason: updateAllScenesForBand - Assertion added.
[sceneID:#myAppName#-default] Setting deactivation reasons to: 'appSwitcher' for reason: updateAllScenesForBand - Assertion removed.
4.After rebooting my iPhone, everything return to normal again.
This bug has happened for several times recently, but I have not encounter this kind of issue before.
Is it a bug in SpringBoard? Or it is a bug in my app, and what can I do to fix it?
Thanks.

Xcode 12 quit unexpectedly in Mac OS 10.15.4

Xcode 12 quit unexpectedly in Mac OS 10.15.4.
The document “Main.storyboard” had an issue that was found and repaired.
This may be due to an SCM operation such as merging. Please save the document to fix the issue.
Multiple resources have the same name: groupTableViewBackgroundColor.
Date/Time: 2020-09-26 08:18:54 +0530
End time: 2020-09-26 08:26:49 +0530
OS Version: Mac OS X 10.15.4 (Build 19E266)
Architecture: x86_64h
Report Version: 29
Data Source: Stackshots
Shared Cache: 0x2fb4000 01EE95E0-91B0-354A-BD0A-C761305CD75D
Command: Xcode
Path: /Applications/Xcode 12.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 12.0 (17219)
Build Version: 2
Product Build Version: 12A7209
Project Name: IDEFrameworks
Source Version: 17219000000000000
Parent: launchd [1]
PID: 2432
Event: hang
Duration: 475.00s
Duration Sampled: 1.99s (process was unresponsive for 473 seconds before sampling)
Steps: 20 (100ms sampling interval)
Hardware model: MacBookAir7,2
Active cpus: 4
Time Awake Since Boot: 5700s
Fan speed: 1234 rpm
--------------------------------------------------
Timeline format: stacks are sorted chronologically
Use -i and -heavy to re-report with count sorting
--------------------------------------------------
Heaviest stack for the main thread of the target process:
20 <truncated backtrace>
20 __psynch_mutexwait + 10 (libsystem_kernel.dylib + 12386) [0x7fff6a22a062]
*20 psynch_mtxcontinue + 0 (pthread + 9566) [0xffffff7f82d6e55e]
Process: Xcode [2432]
UUID: BEF84410-992D-3871-AD2A-C8C9AB4BD25C
Path: /Applications/Xcode 12.app/Contents/MacOS/Xcode
Architecture: x86_64
Parent: launchd [1]
UID: 501
Sudden Term: Tracked
Footprint: 490.54 MB
Start time: 2020-09-26 08:26:47 +0530
End time: 2020-09-26 08:26:48 +0530
Num samples: 20 (1-20)
CPU Time: 0.022s (52.9M cycles, 37.5M instructions, 1.41c/i)
Note: Unresponsive for 473 seconds before sampling
Note: 4 idle work queue threads omitted
I had exactly the same problem.
Good news, I found the solution!
Short story:
You need to find the Views that have tableCellGroupedBackgroundColor as their color and change it.
tip: This color was used by the tableView cells as a background color, look there first.
Long story:
After updating to Xcode 12.2 every time I opened Main.storyboard, the same message was displayed as yours.
Assuming it is a color incompatibility (tableCellGroupedBackgroundColor in our case), I opened Main.storyboard as Source Code (right click on the Main.storyboard -> Open As -> Source Code) and searched for "tableCellGroupedBackgroundColor".
I noticed that this color appeared several times in the "resources" at the end of the file, while it should appear only once.
This is probably why Xcode displays the error message.
Looking above, I noticed that the specific color was in the background color in tableView cells.
So I reopened Main.storyboard as Interface Builder (right click on the Main.storyboard -> Open As -> Interface builder-Storyboard) and changed the background color in all tableView cells to Default.
pro tip: You can delete the colors from the Source code directly, by deleting the lines that refers the colors to the Views.
That's it!
After that everything works perfectly again!
I have a similar issue with additional infos. In xCode 12, and 12.2 beta, my main storyboard appear after many minutes and I get:
The document “Main.storyboard” had 15 issues that were found and repaired.
The save popup also shows:
This may be due to an SCM operation such as merging. Please save the document to fix the issues.
The errors are of 3 types for me:
1- Multiple resources have the same name: darkTextColor.
2- Multiple resources have the same name: groupTableViewBackgroundColor.
3- Multiple resources have the same name: tableCellGroupedBackgroundColor.
It asks to save in order to repair but it does not repair at all.
There are no warning in the environment either before or after the save.
When the project finally loads, if I edit it for a while then it stops responding and I have to force xCode to quit. If I load my app in xCode 11.7 it shows instantly and work fine. If one of our users upgrades to IOS14 with the working version of the app it crashes in some views however if I compile with xCode12, even with storyboard file that I cannot open, and I publish on IOS14 the apps work well and the broken views shows up.
When I debug in xCode 12 and navigate to a broken view the app/xCode stops but no warning or error are displayed. I tried to change and remove this line in the storyboard file without success:

Xcode - is it possible to debug crashes in the Interface Builder's Live Rendering process (IBDesignable)?

Question
Is it possible to set breakpoints and debug code executed by Xcode / Interface Builder's Live Rendering? That is, I am using the IBDesignable and IBInspectable attributes to affect the view as it is rendered in an interface builder storyboard, and would like to be able to debug "IB crashed" errors. I don't recall this from the WWDC session, other than the section on prepareForInterfaceBuilder.
Context
I recently started seeing a number of errors reporting that IB crashed when attempting to render my code. I ultimately traced it to an otherwise innocent line of code in layoutSubviews in one of my views that was linked from the storyboard. The specific problem that IB - when rendering live views, called layoutSubviews before setting all the view's child view properties (which seems like a separate problem, in and of itself). This contrasted with the simulator and device, in which the views were set ahead of the first call to layoutSubviews. Long story short though, it involved diffing a bunch of files to find the offending change. Suffice to say, I could have found the problem quickly if it were possible to set breakpoints and trap the crash.
Has anyone figured out how to debug and/or generally trap these problems, or is that access not yet available?
I watched the WWDC video again (§411 #22:00 or so). You have to
edit a view in IB, and set its custom class to a class in your codebase
set breakpoints as desired in your custom class
select the view in IB, then select Editor -> "Debug Selected Views" (at bottom)
Oddly, in my tests today, it is creating my view via (initWith)Frame instead of (initWith)Coder. This causes subsequent constraint configuration logic to fail as the sub views have not been set (as they would had 'withCoder been called).
(tools note: Xcode 8.2, macOS Sierra)
I had a very different failure than yours: I had a crash in code that resulted in an IB error in Xcode:
error: IB Designables: Failed to update auto layout status: The agent crashed
To debug this on macOS Sierra, open Console.app, and open "User Reports" in the right sidebar. Find the "IBDesignablesCocoaTouch*" crashes, and select the applicable one. This gave me the code-level info I needed to diagnose it.
Crashed Thread: 0
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [0]
Application Specific Information:
CoreSimulator 375.21 - Device: IBSimDeviceTypeiPad2x - Runtime: iOS 10.3 (14E8301) - DeviceType: IBSimDeviceTypeiPad2x
Thread 0 Crashed:
0 libswiftUIKit.dylib 0x000000021a2ddead _TToFE5UIKitCSo7UIImagecfT24imageLiteralResourceNameSS_S0_ + 205
1 libswiftUIKit.dylib 0x000000021a2ddcef _TFE5UIKitCSo7UIImageCfT24imageLiteralResourceNameSS_S0_ + 79
2 com.company.App 0x0000000216df74ad _TZFC10App21ControlsP33_F7118662B6663018C7DD0DEBB6FDD87511buttonImagefT8forStateOS_25State_CSo7UIImage + 109 (Controls.swift:121)
…
(In my case, Interface Builder was failing to load an image literal. I had to implement this workaround: xcode 6 IB_DESIGNABLE- not loading resources from bundle in Interface builder)

How to know which line is causing exception?

I am new to XCode and Objective C. I have intentionally make a mistake to assign number to NSString*.
NSString* s = #1;
[s uppercaseString];
Though XCode gives me warning, this code will compile. But at runtime I get exception. Now I see in logs, (Sorry for image, I was not able to paste is as text properly due to formatting)
In this log, how I find exact place of error. How this log tells me which code to change.
So it looks like you are running the Release build (debug symbols stripped) and if you got that crash log in a production environment you would need to symbolicate it in order to find the line.
This Apple TN gives some details of Symbolication.
In a development environment you would simply add an exception breakpoint and run it from Xcode, as the debug symbols would not be stripped.
To understand what line causes the problem, you usually need to add exception breakpoint to your project as explained in this document;
In the bottom-left corner of the breakpoints navigator, click the
Add button.
Choose Add Exception Breakpoint.
In the Exception pop-up menu, choose the type of exception on which
you want execution to stop:
All. Stops on all exceptions.
Objective-C. Stops on Objective-C exceptions.
C++. Stops on C++ exceptions. To stop on a particular C++ exception, specify the exception name.
Choose the phase of the exception handling process at which you want program execution to stop.
Click Done.
line 5 Sam : [BIDViewController viewDidLoad] + 143 , if this is a release build , you need to resolve with symbols the memory address of the function , this is called "symbolize" the crash dump...
In the log look for your project name and you will come to know.
e.g.
line 5 Sam : [BIDViewController viewDidLoad] + 143
If you want to produce real crash without warning, try following code it will produce index out of bound exception and will crash
NSArray *array = #[#"1",#"2"];
NSLog(#"Item not accessible->%#",(NSString*)array[2]);
set Exception breaking point or enable NSZombie object
or
NSZombie
From the menu bar, choose Project > Scheme > Edit Scheme

Xcode exception breakpoint doesn't print details of the exception being thrown

SUMMARY
When I set an exception breakpoint, I don't get the exception message. How do I get the exception message? I already know how to get the stack trace, but that doesn't include the exception message.
DETAILS
In the past I developed iOS Apps with Xcode and when there was a problem, I'd get an error/exception. The exception would often have a message like "can't dereference null" or whatever.
Now, using Xcode 4.6.x for the past several weeks I've never gotten an exception message. I'll often get a SIGABRT. I put in the break on exception breakpoint and it will break there, but it's off in some assembly within the iOS SDK and I never get a message.
In fact, I can't remember the last time I saw anything show up in the debugger console.
Did exception info dissappear with the migration to LLVM?
It's very frustrating to have my app just crash in the SDK without knowing why. I check the last function to make sure things are set up correctly (objects allocated, etc) and they are which means I'm left with no clues.
Is it possibly a build setting held over from the past is somehow turning off exception messages?
Please reopen question. It now has an answer!
In the comments an excellent answer has been given. This should be promoted to full answer, and so I can mark the question answered and others who have this common issue can find it. In order for that to happen, the question needs to be reopened! (I'll delete this plea after that happens.)
I will update Jeff's answer here:
To have both the line causing the exception highlighted (and not UIApplicationMain() in main.m) AND to see the reason for the exception (e.g., "error: A fetch request must have an entity."), do this:
In the Breakpoint navigator:
Add (+), Add Exception Breakpoint
Select the new breakpoint, Control-Click, Edit Breakpoint
Add Action
Enter: po $arg1
The relevant part of the stack trace will be in the nagivator area.
This seems to still work in Xcode 9
Here is my addition for use with Xcode 6 and below.
Enter: po (NSException*) $eax
In Xcode 6 you must explicitly provide the object type because it is no longer inferred.
For Xcode 7-9 (based off Jeff's answer):
In the Breakpoint navigator:
Add (+), Add Exception Breakpoint
Select the new breakpoint, Control-Click, Edit Breakpoint
Add Action
Enter: po $arg1
To have both the line causing the exception highlighted (and not UIApplicationMain() in main.m) AND to see the reason for the exception (e.g., "error: A fetch request must have an entity."), do this:
In the Breakpoint navigator:
Add (+), Add Exception Breakpoint
Select the new breakpoint, Contorl-Click, Edit Breakpoint
Add Action
Enter: po $eax
The relevant part of the stack trace will be in the nagivator area.
Yes xcode is not so friendly for debugging. I like this article which helps me to understand crash logs a bit clearly))
Demystifying iOS Application Crash Logs
Also do this if you see error "message sent to deallocated instance"
'Products -> Edit Scheme -> Enable Zombie Objects'
this will enable zombie objects and when you do profile to your project choose
"zombie", cause error and you will be able to see which objects was deallocated e.g NSArray *myArray
The information I get from po $eax or po (NSException *)$eax seems to be different from what Xcode would print if no exception breakpoints are set. So I do the following,
Add an exception breakpoint
Exception occurs, breakpoint was hit -> I know the location
Temporarily disable breakpoints (second button on the left in Debug area)
Continue program execution (third button on the left in Debug area)
Details are printed -> I know the cause
Obviously not very elegant and flexible, but at least I two big questions are answered (where and why).
You can use bt or thread backtrace command to print error trace
Show the stack backtrace for the current thread.
The same stack trace you can find in crash reports
Information about current thread use currentThread
//Objective-C
po [NSThread currentThread]
//Swift
po Thread.currentThread
*Sometimes you can use fr v(or just v from XCode 10.2) when po is not working

Resources