This call:
[UIKeyboardImpl(ShortcutConversionSupport) _shortcutConversionCandidateForInput:]
is crashing my app. Googling and looking through Apple's API documentation brings up no results. I have never seen this call being made anywhere in my app. I also put a break-point at the location I believe it is getting called at. Here is the crash report:
(FYI, the crash log could not be completely symbolicated even when using the correct dSYM file. No idea why)
Last Exception Backtrace:
0 CoreFoundation 0x327e188f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x34837259 objc_exception_throw + 33
2 CoreFoundation 0x327e1789 +[NSException raise:format:] + 1
3 CoreFoundation 0x327e17ab +[NSException raise:format:] + 35
4 CoreFoundation 0x3273bf5b -[__NSCFString substringWithRange:] + 103
5 Buffer 0x000fa061 0xd6000 + 147553
6 UIKit 0x32348137 -[UIKeyboardImpl(ShortcutConversionSupport) _shortcutConversionCandidateForInput:] + 615
7 UIKit 0x32322c07 -[UIKeyboardImpl addInputString:fromVariantKey:] + 287
8 UIKit 0x32322ae1 -[UIKeyboardImpl handleStringInput:fromVariantKey:] + 165
9 UIKit 0x32321829 -[UIKeyboardImpl handleKeyEvent:] + 1501
10 UIKit 0x02b10261 0x2af4000 + 115297
11 UIKit 0x324bb8a3 -[UIKeyboardLayoutStar sendStringAction:forKey:isPopupVariant:] + 487
12 UIKit 0x3231fdcd -[UIKeyboardLayoutStar touchUp:] + 3197
13 UIKit 0x02b2ab47 0x2af4000 + 224071
14 UIKit 0x3231f0fd -[UIKeyboardLayout touchesEnded:withEvent:] + 381
15 UIKit 0x3222292b -[UIWindow _sendTouchesForEvent:] + 319
16 UIKit 0x32222319 -[UIWindow sendEvent:] + 381
17 UIKit 0x32208695 -[UIApplication sendEvent:] + 357
18 UIKit 0x32207f3b _UIApplicationHandleEvent + 5827
19 GraphicsServices 0x3188f22b PurpleEventCallback + 883
20 CoreFoundation 0x327b5523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
21 CoreFoundation 0x327b54c5 __CFRunLoopDoSource1 + 141
22 CoreFoundation 0x327b4313 __CFRunLoopRun + 1371
23 CoreFoundation 0x327374a5 CFRunLoopRunSpecific + 301
24 CoreFoundation 0x3273736d CFRunLoopRunInMode + 105
25 GraphicsServices 0x3188e439 GSEventRunModal + 137
26 UIKit 0x32236cd5 UIApplicationMain + 1081
27 Buffer 0x000d8327 0xd6000 + 8999
28 Buffer 0x000d7dcc 0xd6000 + 7628
I understand that is crashing at substringWithRange: but when does this particular ShortcutConversionSupport method get called? I believe that will help me isolate the issue.
This is the issue:
- (UITextRange *)textRangeFromPosition:(UITextPosition *)fromPosition toPosition:(UITextPosition *)toPosition
{
// Generate IndexedPosition instances that wrap the to and from ranges
IndexedPosition *from = (IndexedPosition *)fromPosition;
IndexedPosition *to = (IndexedPosition *)toPosition;
NSRange range = NSMakeRange(MIN(from.index, to.index), ABS(to.index - from.index));
return [IndexedRange rangeWithNSRange:range];
}
More specifically: ABS(to.index - from.index)
The issue is that the compiler thinks that the product of this negation is a NSUInteger because to.index and from.index are both NSUInteger variables (so the value can never be negative). Therefore, if from.index > to.index the value would overflow producing a value that is the max size of a 32 bit uint rather than a negative value. Also note, ABS uses typeof to determine the return value of the product. This is the fix:
- (UITextRange *)textRangeFromPosition:(UITextPosition *)fromPosition toPosition:(UITextPosition *)toPosition
{
IndexedPosition *from = (IndexedPosition *)fromPosition;
IndexedPosition *to = (IndexedPosition *)toPosition;
NSInteger index = to.index - from.index;
NSRange range = NSMakeRange(MIN(from.index, to.index), ABS(index));
return [IndexedRange rangeWithNSRange:range];
}
By the way, this only occurs when a user has removed all of the Shortcuts in Settings > General > Keyboard > Shortcuts.
Related
I have the following code to retrieve the currentTrack's artwork (using iTunes.h):
iTunesArtwork *iTunesArtwork = [[iTunes.currentTrack artworks] objectAtIndex:0];
NSImage *artwork = iTunesArtwork.data;
if (artwork != nil){
[_musicImageView setImage:artwork];
}
It works for most of the tracks but sometimes it gives me this error (even when the track has an image):
NSImageCell's object value must be an NSImage.
2012-12-28 00:22:12.217 App[3256:303] (
0 CoreFoundation 0x00007fff904360a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8d5bf3f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff90435e7c +[NSException raise:format:] + 204
3 AppKit 0x00007fff9747c31b -[NSImageCell setObjectValue:] + 106
4 AppKit 0x00007fff974b8563 -[NSImageView setImage:] + 90
5 App 0x0000000100001b38 -[AppDelegate setupPlayer] + 600
6 Foundation 0x00007fff8d10c513 __NSFireTimer + 96
7 CoreFoundation 0x00007fff903f2da4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
8 CoreFoundation 0x00007fff903f28bd __CFRunLoopDoTimer + 557
9 CoreFoundation 0x00007fff903d8099 __CFRunLoopRun + 1513
10 CoreFoundation 0x00007fff903d76b2 CFRunLoopRunSpecific + 290
11 HIToolbox 0x00007fff939e40a4 RunCurrentEventLoopInMode + 209
12 HIToolbox 0x00007fff939e3e42 ReceiveNextEventCommon + 356
13 HIToolbox 0x00007fff939e3cd3 BlockUntilNextEventMatchingListInMode + 62
14 AppKit 0x00007fff97337613 _DPSNextEvent + 685
15 AppKit 0x00007fff97336ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
16 AppKit 0x00007fff9732e283 -[NSApplication run] + 517
17 AppKit 0x00007fff972d2cb6 NSApplicationMain + 869
18 App 0x0000000100001822 main + 34
19 libdyld.dylib 0x00007fff93cb77e1 start + 0
)
Any ideas on what's going on?
make sure it is an image -- not just check if its not nil, thats not enough. the type in an h file must not be the type the object really has. It is more like... it SHOULD be an image :D
if([artwork isKindOfClass:[NSImage class]]) {
....
from the comments.
That didnt always work. ell. no more crashes but some images didnt show. we used the rawData as fallback:
//kind of like this
if(![artwork isKindOfClass:[NSImage class]]) {
artwork = [[NSImage alloc] initWithData:tunesArtwork.rawData];
}
if([artwork isKindOfClass:[NSImage class]]) {
...
}
I found a weird crash issue in my app, and I can't got enough message from the crash report.
Here is the crash report:
-[TileLayer _isChargeEnabled]: unrecognized selector sent to instance 0x14aeadb0
(null)
(
0 CoreFoundation 0x376298a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x3169e259 objc_exception_throw + 32
2 CoreFoundation 0x3762ca9b -[NSObject doesNotRecognizeSelector:] + 174
3 CoreFoundation 0x3762b915 ___forwarding___ + 300
4 CoreFoundation 0x37586650 _CF_forwarding_prep_0 + 48
5 UIKit 0x30775e43 -[UIWindow warpPoint:] + 686
6 UIKit 0x3075c1ff _UIApplicationHandleEvent + 2438
7 GraphicsServices 0x3777922b PurpleEventCallback + 882
8 CoreFoundation 0x375fd523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
9 CoreFoundation 0x375fd4c5 __CFRunLoopDoSource1 + 140
10 CoreFoundation 0x375fc313 __CFRunLoopRun + 1370
11 CoreFoundation 0x3757f4a5 CFRunLoopRunSpecific + 300
12 CoreFoundation 0x3757f36d CFRunLoopRunInMode + 104
13 GraphicsServices 0x37778439 GSEventRunModal + 136
14 UIKit 0x3078bcd5 UIApplicationMain + 1080
15 Movie 0x00022eb3 _mh_execute_header + 7859
16 Movie 0x00022e40 _mh_execute_header + 7744
)
Well, it means you tried passing a message (a.k.a calling a method) _isChargeEnabled to an object of class TileLayer, but it is non-existent.
UPDATE
I did a quick google search and turns out _isChargeEnabled is private API of Apple. You could check this and this for more information.
I currently use ASIHTTPRequest for synchronous requests
I recently refactored my code to comply with ARC and omit the ASIHTTPRequest class using the compiler flag -fno-objc-arc
I have a _mh_execute_header SIGSEGV crash when I use any type of optimization
While turning off all optimization allows my app to run - I need to be able to optimize the app using the iOS default settings which use Fastest, Smallest [-Os]
Since this is a memory related issue and since the only manually managed memory resides within ASIHTTPRequest - is using ASI with ARC my problem?
Stack Trace:
Thread: Unknown Name (Crashed)
0 libobjc.A.dylib 0x37b9ef7e objc_msgSend + 21
1 Test 0x000dcda5 _mh_execute_header + 126373
2 Test 0x000dc4b9 _mh_execute_header + 124089
3 Test 0x000cd801 _mh_execute_header + 63489
4 Test 0x000ce39d _mh_execute_header + 66461
5 Test 0x000cf561 _mh_execute_header + 71009
6 Test 0x000d3e3d _mh_execute_header + 89661
7 UIKit 0x3334ccbd -[UITextField keyboardInput:shouldInsertText:isMarkedText:] + 148
8 UIKit 0x3334cc1f -[UIFieldEditor keyboardInput:shouldInsertText:isMarkedText:] + 94
9 UIKit 0x3334cbb9 -[UIKeyboardImpl callShouldInsertText:] + 108
10 UIKit 0x3334bb5b -[UIKeyboardImpl addInputString:fromVariantKey:] + 114
11 UIKit 0x3334bae1 -[UIKeyboardImpl handleStringInput:fromVariantKey:] + 164
12 UIKit 0x3334a775 -[UIKeyboardImpl handleKeyEvent:] + 1320
13 UIKit 0x334e48a3 -[UIKeyboardLayoutStar sendStringAction:forKey:isPopupVariant:] + 486
14 UIKit 0x33348dcd -[UIKeyboardLayoutStar touchUp:] + 3196
15 UIKit 0x333480fd -[UIKeyboardLayout touchesEnded:withEvent:] + 380
16 UIKit 0x3324b92b -[UIWindow _sendTouchesForEvent:] + 318
17 UIKit 0x3324b319 -[UIWindow sendEvent:] + 380
18 UIKit 0x33231695 -[UIApplication sendEvent:] + 356
19 UIKit 0x33230f3b _UIApplicationHandleEvent + 5826
20 GraphicsServices 0x373f022b PurpleEventCallback + 882
21 CoreFoundation 0x357d1523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
22 CoreFoundation 0x357d14c5 __CFRunLoopDoSource1 + 140
23 CoreFoundation 0x357d0313 __CFRunLoopRun + 1370
24 CoreFoundation 0x357534a5 CFRunLoopRunSpecific + 300
25 CoreFoundation 0x3575336d CFRunLoopRunInMode + 104
26 GraphicsServices 0x373ef439 GSEventRunModal + 136
27 UIKit 0x3325fcd5 UIApplicationMain + 1080
28 Test 0x000bfc1b _mh_execute_header + 7195
I am creating a program that requires me to build an NSMutable array and then add objects to that array as buttons are clicked.
After the user has clicked all the buttons that they want (therefore adding all the objects that they need into the mutable array) I need to sort the array based on the objects name.
The objects are NSImageViews that are added to the array with names like view1, view2, view40.
I need a way to sort the objects in the array according to the numbers in the last digit of their name.
I was using
[nameOfArray sortUsingSelector:#selector(caseInsensitiveCompare:)];
but when I run the app I get SIGABRT at that line.
I have looked at many many other threads and can not find a solution.
Any help is greatly appreciated, as I have been working on this for several weeks now,
Anybody know what I am doing wrong?
EDIT , Here is what the debugger said afterwords
2011-09-30 08:16:06.669 CAP helper[9874:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView caseInsensitiveCompare:]: unrecognized selector sent to instance 0x4e5f650'
*** Call stack at first throw:
(
0 CoreFoundation 0x00de05a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f34313 objc_exception_throw + 44
2 CoreFoundation 0x00de20bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d51966 ___forwarding___ + 966
4 CoreFoundation 0x00d51522 _CF_forwarding_prep_0 + 50
5 CoreFoundation 0x00d472f6 __CFSimpleMergeSort + 374
6 CoreFoundation 0x00d4706c CFSortIndexes + 268
7 CoreFoundation 0x00dda642 -[NSMutableArray sortRange:options:usingComparator:] + 274
8 CoreFoundation 0x00d598cf -[NSMutableArray sortWithOptions:usingComparator:] + 95
9 CoreFoundation 0x00d5983c -[NSMutableArray sortUsingSelector:] + 108
10 CAP helper 0x0000cf81 -[RibbonStacker stackit:] + 305
11 UIKit 0x000324fd -[UIApplication sendAction:to:from:forEvent:] + 119
12 UIKit 0x000c2799 -[UIControl sendAction:to:forEvent:] + 67
13 UIKit 0x000c4c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
14 UIKit 0x000c37d8 -[UIControl touchesEnded:withEvent:] + 458
15 UIKit 0x00056ded -[UIWindow _sendTouchesForEvent:] + 567
16 UIKit 0x00037c37 -[UIApplication sendEvent:] + 447
17 UIKit 0x0003cf2e _UIApplicationHandleEvent + 7576
18 GraphicsServices 0x01019992 PurpleEventCallback + 1550
19 CoreFoundation 0x00dc1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
20 CoreFoundation 0x00d21cf7 __CFRunLoopDoSource1 + 215
21 CoreFoundation 0x00d1ef83 __CFRunLoopRun + 979
22 CoreFoundation 0x00d1e840 CFRunLoopRunSpecific + 208
23 CoreFoundation 0x00d1e761 CFRunLoopRunInMode + 97
24 GraphicsServices 0x010181c4 GSEventRunModal + 217
25 GraphicsServices 0x01018289 GSEventRun + 115
26 UIKit 0x00040c93 UIApplicationMain + 1160
27 CAP helper 0x00002219 main + 121
28 CAP helper 0x00002195 start + 53
29 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exception
Current language: auto; currently objective-c>
Your array contains UIImageViews and your sort calls caseInsensitiveCompare: on those instances of UIImageView, but that class doesn't have any method by that name. You should do something like this:
[nameOfArray sortUsingComparator:^(id obj1, id obj2) {
UIImageView *view1 = obj1;
UIImageView *view2 = obj2;
// Somehow compare the views and return NSOrderedAscending,
// NSOrderedDescending or NSOrderedSame, for example by calling
// appropriate "compare:" methods.
return myComparisonResult
}];
Okay, I have a program that I'm trying to test on my iPad. I have it all set up so that the app is able to get on the iPad just fine, but running it on the iPad is a different story.
Now, the thing is, my program was working fine on the debug configuration, but now it won't work on that, either. It's strange, because before I was able to get to a certain part of the program before it crashed, but now it's crashing before that.
The debugger is hardly helping. When I use the debugger window, it will step into one line of code, and then suddenly jump back to another line of code.
I really don't understand what's going on. The crash is now occuring in a root view controller that I have set up, called 'FunctionMachineViewController. Here's the code for when it crashes:
-(IBAction)startOnePlayer:(id)sender
{
GameViewController* GameView = [[GameViewController alloc] initWithNibName:nil bundle:nil];
[GameView isOnePlayer:YES withLevel:startLevelNumber];
[self presentModalViewController:GameView animated:YES];
}
GameViewController is supposed to initialize just fine, but the debugger shows it as uninitialized. I even tried setting it up in the header file instead, but the problem still happens. Has anyone else come across these problems? Any help would be greatly appreciated!
EDIT: Here's what the console says when it crashes:
[Session started at 2011-06-02 21:46:10 -0700.]
2011-06-02 21:46:13.309 FunctionMachine[5033:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GameViewController 0x4b2a890> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Yminus2.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dd55a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f29313 objc_exception_throw + 44
2 CoreFoundation 0x00dd54e1 -[NSException raise] + 17
3 Foundation 0x0003d677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003d5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004c130c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d4b8cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004bfd23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004c1ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x00377628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x00375134 -[UIViewController loadView] + 120
11 UIKit 0x0037500e -[UIViewController view] + 56
12 UIKit 0x00376a3d -[UIViewController viewControllerForRotation] + 63
13 UIKit 0x00372988 -[UIViewController _visibleView] + 90
14 UIKit 0x0061493c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
15 UIKit 0x002ec81e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
16 UIKit 0x00574619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
17 UIKit 0x0037965d -[UIViewController presentModalViewController:withTransition:] + 3478
18 FunctionMachine 0x00001fdd -[FunctionMachineViewController startOnePlayer:] + 227
19 UIKit 0x002c54fd -[UIApplication sendAction:to:from:forEvent:] + 119
20 UIKit 0x00355799 -[UIControl sendAction:to:forEvent:] + 67
21 UIKit 0x00357c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
22 UIKit 0x00356a1c -[UIControl touchesBegan:withEvent:] + 277
23 UIKit 0x002e9d41 -[UIWindow _sendTouchesForEvent:] + 395
24 UIKit 0x002cac37 -[UIApplication sendEvent:] + 447
25 UIKit 0x002cff2e _UIApplicationHandleEvent + 7576
26 GraphicsServices 0x0172d992 PurpleEventCallback + 1550
27 CoreFoundation 0x00db6944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
28 CoreFoundation 0x00d16cf7 __CFRunLoopDoSource1 + 215
29 CoreFoundation 0x00d13f83 __CFRunLoopRun + 979
30 CoreFoundation 0x00d13840 CFRunLoopRunSpecific + 208
31 CoreFoundation 0x00d13761 CFRunLoopRunInMode + 97
32 GraphicsServices 0x0172c1c4 GSEventRunModal + 217
33 GraphicsServices 0x0172c289 GSEventRun + 115
34 UIKit 0x002d3c93 UIApplicationMain + 1160
35 FunctionMachine 0x00001c64 main + 102
36 FunctionMachine 0x00001bf5 start + 53
37 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Turns out that, when I went and changed the name of several UILabels in the header of GameViewController, I forgot to fix the names in the interface builder, too. Don't know if that was what was causing the debugger to act weird, but everything is working now!