I am working on setting page for iPhone.
When I click account menu on setting page. it crashes and shows me this error.
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM replaceObjectAtIndex:withObject:]: index 4 beyond bounds [0 .. 3]'
Can you tell me where do I suppose to look at?
In the Xcode debugger, set either a global breakpoint at "replaceObjectAtIndex: withObject" or look for any and all calls to "replaceObjectAtIndex: withObject" in your code and set breakpoints there and see if you can catch where / when the exception happens.
Here's a bit of help from Apple's Xcode documentation, I'm looking at a chapter called "Breakpoint Navigator".
Related
I created a simple UWP app from the VS 2017 blank UWP template. No added XAML or C# code-behind:
Create new app with Blank Universal Windows template
Set Debugger type to Mixed (Managed and Native)
Build and Run (No XAML or code added)
Following error: WinRT originate error - 0x80070490 : 'Element not found.'
This happens every time. Does anyone have a handle on this error? If I don't have Mixed Mode debugging on, I don't see the error but I'm assuming it's still there. Is this an error that I should be concerned about?
Thank you.
A lot of problem may result this error, and it should not be a fatal error in your case. Most likely you changed the default Exception Settings in visual studio.
Just like all other apps, Windows use exceptions and catch them at different level.
For end user, you should not see this exception and app should not crash.
In your situation, I think you click continue and the program should not crash, and it should not be a big concern.
I suggest you:
1, start and debug your app, open Debug|Windows|Exception Setting, then click the 'restore the list to default settings' button
2, restart your app.
3, You should not catch the exception, but you still see error message in Output window.
If you still see a exception window popup, you need to post more information like your os version, and then someone can help you
I met this error when I call the winRT api CommunityToolkit.WinUI.Notifications.ToastNotificationHistoryCompat.Clear(). Then let the app toast someting once the error had gone.
I have a problem with Xcode 9 (up to beta 6), in which it seems that the error stack is not being displayed in the Debug Output pane. For example, for a SIGABRT error the only description is:
libc++abi.dylib: terminating with uncaught exception of type NSException
In Xcode 8 the error stack is displayed just fine, e.g.:
*** Terminating app due to uncaught exception '...''
*** First throw call stack:
...
...
...
Also for build failers, the output is minimal and only via the Report Navigator more details of the error can be obtained.
I encounter this issue in all beta's of Xcode 9, which makes debugging rather annoying.
Any idea's?
I found the same issue using Xcode 9. My problem turned out to be that I had set the OS_ACTIVITY_MODE variable to disabled in Xcode 8 because of all the additional debugging information output in the debugger that I didn't want to see.
To check if you have this variable set (and turn it off), in Xcode 9, do the following:
Select from Xcode menu Product -> Scheme -> Edit Scheme..
Select the Run scheme and look under Arguments.
If you see the OS_ACTIVITY_MODE variable checked, deselect it.
Below is a screen shot of my scheme before unchecking the setting.
Hope that helps someone.
Xcode 9 Scheme settings
How can I change the preferences in Xcode so that it highlights the exact location of an error like other programming environments instead of simply returning SIGABRT? Or is this not possible?
Xcode should already stop and show where execution is when a signal like SIGABRT occurs. (It does for me, without any special configuration).
a NSInvalidArgumentException occurs Xcode only highlights main.m
It's not signals you need to catch for that, it's exceptions. Go to the breakpoint navigator and add an exception breakpoint.
If I don't set a breakpoint on exceptions in Xcode 4.2, I get very good explanations, like this one:
exception -[NSLayoutManager
_fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] *** attempted
glyph generation while textStorage is editing. It is not valid to cause the
layoutManager to do glyph generation while the textStorage is editing
(ie the textStorage has been sent a beginEditing message without a matching endEditing.)
If I do set a breakpoint, I get the location of the problem, which is also good. But then I don't get the explanation. Nothing at all is written to the console, even if I continue.
How can I get both? Presumably, since Xcode stopped on the exception, the exception object is somewhere in the debugger when I can get to it.
Enable Zombie Objects for get location of exception:
Go to menu Product -> Scheme -> Edit Scheme... -> tab Diagnostics -> ON checkbox Enable Zombie Objects
I had a xib file with an old outlet connected. That would crash and set a breakpoint on the line pushing the view controller with :
Catchpoint 2 (throw)Pending breakpoint 1 - "objc_exception_throw" resolved
Not very helpful, I remember in XCode 3 I had something like "an outlet is not connected"
How do I get that back ?
edit : if I check "automatically continue after evaluating actions", I get this message :
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<OrderController 0x7942760> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key table.'
*** First throw call stack:
(0x16e1052 0x2182d0a 0x16e0f11 0x4cb032 0x43cf7b 0x43ceeb 0x457d60 0x99991a 0x16e2e1a 0x164c821 0x99846e 0x83fe2c 0x8403a9 0x8405cb 0x840941 0x85247d 0x85266f 0x85293b 0x8533df 0x853986 0xcf67dbd 0x8535a4 0x3a3da 0x841fbf 0x8422d4 0x8425d7 0x842785 0x85c0a5 0x842730 0x78b5ea 0x16b59ce 0x164c670 0x16184f6 0x1617db4 0x1617ccb 0x18f7879 0x18f793e 0x77aa9b 0x276d 0x1fd5)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
(gdb)
which is better than nother, but the breakpoint stops on main.m ! Here is the current setup of my breakpoint
Mystery solved. At least for me, hitting 'continue' a couple of times allowed the error to be printed to the console.
The issue (in this case) was having a couple of other custom breakpoints set (objc_exception_throw, -[NSException raise]).
Enabling "automatically continue after evaluating" for BOTH allowed the process to be killed without manual intervention, somewhere around which time the detailed error message was printed to the console.
Hope this helps.
If you have multiple projects, make sure that the breakpoint is active for the correct project. I recommend using a Xcode 4 workspace in this case and assign the global exceptions breakpoint to the workspace. You can do that by right-clicking the breakpoint in the Breakpoints Navigator pane and select "Move Breakpoint to…"