Custom font produce crash - ios

We created custom font for our application with custom Emoji symbols. Sometimes app crashes with following stacktrace (always the same):
0 libsystem_platform.dylib 0x38b8d486 _platform_memmove$VARIANT$Swift + 102
1 CoreFoundation 0x2d8f7575 CFDataGetBytes + 237
2 ImageIO 0x2e6e1e8f CGImageReadGetBytesAtOffset + 299
3 ImageIO 0x2e6e1d59 CGImageReadSessionGetBytes + 29
4 ImageIO 0x2e825973 read_fn + 23
5 ImageIO 0x2e6e1cb1 png_read_sig + 45
6 ImageIO 0x2e6e1935 _cg_png_read_info + 33
7 ImageIO 0x2e6ea15b copyImageBlockSetPNG + 1123
8 ImageIO 0x2e6e9779 ImageProviderCopyImageBlockSetCallback + 529
9 CoreGraphics 0x2da2647d CGImageProviderCopyImageBlockSetWithOptions + 137
10 CoreGraphics 0x2da492f7 CGImageProviderCopyImageBlockSet + 39
11 CoreGraphics 0x2da2614f img_blocks_create + 411
12 CoreGraphics 0x2da492bb img_blocks_extent + 63
13 CoreGraphics 0x2da49271 img_interpolate_extent + 109
14 CoreGraphics 0x2da1a12d img_data_lock + 4421
15 CoreGraphics 0x2da187e9 CGSImageDataLock + 89
16 libRIP.A.dylib 0x2dd65da7 ripc_AcquireImage + 99
17 libRIP.A.dylib 0x2dd65131 ripc_DrawImage + 601
18 CoreGraphics 0x2da186fb CGContextDelegateDrawImage + 51
19 CoreGraphics 0x2da18581 CGContextDrawImage + 285
20 CoreText 0x2e0a43db TCGImageData::DrawInRect(CGRect) const + 311
21 CoreText 0x2e062299 CTFontDrawGlyphsWithAdvances + 705
22 CoreText 0x2e070d55 TRun::DrawGlyphs(CGContext*, CFRange) const + 241
23 CoreText 0x2e070c25 TLine::DrawGlyphs(CGContext*) const + 157
24 UIFoundation 0x358860df __NSStringDrawingEngine + 10151
25 UIFoundation 0x35883863 -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 151
26 UIKit 0x301e72c9 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 4225
27 UIKit 0x3024d709 -[UILabel drawTextInRect:] + 501
28 UIKit 0x3024d50b -[UILabel drawRect:] + 79
29 UIKit 0x3024d4a9 -[UIView(CALayerDelegate) drawLayer:inContext:] + 373
30 QuartzCore 0x2fe79189 -[CALayer drawInContext:] + 101
I don't know is it possible to get help for such situation, but maybe someone from Apple could give advice what is wrong with font. I could provide font if needed.

Unfortunately this is not a conclusive answer, but it's too long for a comment so I guess feel free to downvote, those who do that sort of thing. But I hope you won't, because I think this could be useful information.
I took a pretty deep look into this font, which uses the newly-defined 'sbix' table, just as Apple's Color Emoji font does, to store color images (PNGs in this case) for icons. I went through the data table and dumped out each of the icons to PNG files and everything appeared to be okay (what it means is: the 'sbix' table itself seems to follow the specification, and the resulting PNG images do not appear to be corrupted and are in fact rather amusing!).
However: there are some characteristics of this font compared to the Apple Color Emoji font that I find a bit odd. Apple's font has 7 "strikes" (sizes): 20, 32, 40, 48, 64, 96, 160, whereas yours has only one: 285. My understanding is that the system is supposed to up/down-scale when asked for a font size that doesn't exist in the font (e.g. you call for 50, it scales 285 down to 50), but given that Apple's maximum strike size is 160 it makes me wonder whether there is some unspecified upper size limit for fonts. Another thing I noticed is that the PNG data is 256 pixels wide and I'm not sure how that's supposed to relate to the 285 size (maybe padding?).
Looking at the stack trace, it looks like it's getting the image data out of the font, but failing somewhere during the actual rendering of the image.
I'm not sure what you used to create this font, but something you might try if you can is to scale the images such that your strike size is 160, matching Apple's maximum, and see what happens there. Sorry I could not be of more help, but I hope this at least gives you something to investigate further.

Related

Swift/iOS crash log does not contain line number

I'm deploying a build to testers via TestFlight and the app is crashing. I cannot reproduce the crash on my end so I am trying to rely on the crash logs listed in Xcode Organizer.
Unfortunately the crashes here contain some information, but nothing that allows me to identify the line of code that is causing the crash. Usually when I click on a crash in the Organizer window, it automatically shows me the line in Xcode that caused the crash.
Here's the raw crash log, which also does not contain a line number, only the file and method in which the crash occured.
Thread 0 name:
Thread 0 Crashed:
0 libswiftCore.dylib 0x0000000103154b8c 0x102f64000 + 2034572
1 libswiftCore.dylib 0x0000000103154b8c 0x102f64000 + 2034572
2 libswiftCore.dylib 0x000000010316017c 0x102f64000 + 2081148
3 libswiftCore.dylib 0x0000000103105cfc 0x102f64000 + 1711356
4 libswiftCore.dylib 0x0000000103160984 0x102f64000 + 2083204
5 libswiftCore.dylib 0x00000001030ad2f8 0x102f64000 + 1348344
6 AppName 0x0000000102c92748 specialized TableViewController.sendSmsMessage(sender:) + 8816 (TableViewController.swift:0)
(TableViewController.swift:0)
7 AppName 0x0000000102c8c448 #objc TableViewController.CorF(sender:) + 44
8 UIKitCore 0x00000001ea7a6314 -[UIApplication sendAction:to:from:forEvent:] + 96 (UIApplication.m:4786)
9 UIKitCore 0x00000001ea233d54 -[UIControl sendAction:to:forEvent:] + 80 (UIControl.m:624)
10 UIKitCore 0x00000001ea234074 -[UIControl _sendActionsForEvents:withEvent:] + 440 (UIControl.m:707)
11 UIKitCore 0x00000001ea233074 -[UIControl touchesEnded:withEvent:] + 568 (UIControl.m:461)
12 UIKitCore 0x00000001ea7dfa6c -[UIWindow _sendTouchesForEvent:] + 2472 (UIWindow.m:2204)
13 UIKitCore 0x00000001ea7e0cd0 -[UIWindow sendEvent:] + 3156 (UIWindow.m:2453)
14 UIKitCore 0x00000001ea7bffcc -[UIApplication sendEvent:] + 340 (UIApplication.m:10819)
15 UIKitCore 0x00000001ea88ee38 __dispatchPreprocessedEventFromEventQueue + 1620 (UIEventDispatcher.m:1678)
16 UIKitCore 0x00000001ea891830 __handleEventQueueInternal + 4740 (UIEventDispatcher.m:1937)
17 UIKitCore 0x00000001ea88a320 __handleHIDEventFetcherDrain + 152 (UIEventDispatcher.m:1905)
18 CoreFoundation 0x00000001bd44a0e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1980)
19 CoreFoundation 0x00000001bd44a060 __CFRunLoopDoSource0 + 88 (CFRunLoop.c:2015)
20 CoreFoundation 0x00000001bd449944 __CFRunLoopDoSources0 + 176 (CFRunLoop.c:2051)
21 CoreFoundation 0x00000001bd444810 __CFRunLoopRun + 1040 (CFRunLoop.c:2922)
22 CoreFoundation 0x00000001bd4440e0 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
23 GraphicsServices 0x00000001bf6bd584 GSEventRunModal + 100 (GSEvent.c:2245)
24 UIKitCore 0x00000001ea7a4c00 UIApplicationMain + 212 (UIApplication.m:4347)
25 AppName 0x0000000102c7d0f0 main + 60 (SMS.swift:12)
26 libdyld.dylib 0x00000001bcf02bb4 start + 4
Any idea on how I can determine the line that is causing the crash?
EDIT: I was able to get the user to send me a crash report stored on their device as suggested by #Václav, but it doesn't seem to contain much helpful information either:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x0000000104e774ec 0x104c8c000 + 2012396
1 libswiftCore.dylib 0x0000000104e774ec 0x104c8c000 + 2012396
2 libswiftCore.dylib 0x0000000104e828cc 0x104c8c000 + 2058444
3 libswiftCore.dylib 0x0000000104e28fd4 0x104c8c000 + 1691604
4 libswiftCore.dylib 0x0000000104e830cc 0x104c8c000 + 2060492
5 libswiftCore.dylib 0x0000000104dd142c 0x104c8c000 + 1332268
6 AppName 0x00000001047fa948 0x1047e0000 + 108872
7 AppName 0x00000001047f4784 0x1047e0000 + 83844
8 UIKitCore 0x00000001e6fe6314 0x1e66fc000 + 9347860
9 UIKitCore 0x00000001e6a73d54 0x1e66fc000 + 3636564
10 UIKitCore 0x00000001e6a74074 0x1e66fc000 + 3637364
11 UIKitCore 0x00000001e6a73074 0x1e66fc000 + 3633268
12 UIKitCore 0x00000001e6bfaaf0 0x1e66fc000 + 5237488
13 UIKitCore 0x00000001e6bf57ec 0x1e66fc000 + 5216236
14 UIKitCore 0x00000001e6bf52cc 0x1e66fc000 + 5214924
15 UIKitCore 0x00000001e6bf509c 0x1e66fc000 + 5214364
16 UIKitCore 0x00000001e7020cb4 0x1e66fc000 + 9587892
17 UIKitCore 0x00000001e6ffffcc 0x1e66fc000 + 9453516
18 UIKitCore 0x00000001e70cee38 0x1e66fc000 + 10300984
19 UIKitCore 0x00000001e70d1830 0x1e66fc000 + 10311728
20 UIKitCore 0x00000001e70ca320 0x1e66fc000 + 10281760
21 CoreFoundation 0x00000001b9c8a0e0 0x1b9bdd000 + 708832
22 CoreFoundation 0x00000001b9c8a060 0x1b9bdd000 + 708704
23 CoreFoundation 0x00000001b9c89944 0x1b9bdd000 + 706884
24 CoreFoundation 0x00000001b9c84810 0x1b9bdd000 + 686096
25 CoreFoundation 0x00000001b9c840e0 0x1b9bdd000 + 684256
26 GraphicsServices 0x00000001bbefd584 0x1bbef2000 + 46468
27 UIKitCore 0x00000001e6fe4c00 0x1e66fc000 + 9341952
28 AppName 0x00000001047e5860 0x1047e0000 + 22624
29 libdyld.dylib 0x00000001b9742bb4 0x1b9742000 + 2996
There are a few different elements to this question, so let me try to break it down.
Why do I see line 0?
The Swift compiler does a fair amount of code generation before actually producing a final compiled binary. In this situation, line 0 is the compiler's way of telling you that it generated code while compiling TableViewController.swift, but that code doesn't correspond to a specific line in the original source.
Because you've got a specialized function here, I'm much more inclined to believe this is compiler-generated code. This usually means the compiler is working with generic types.
I'm disappointed that Apple communicates this event in this way, but there's not much we can do. My understanding is that DWARF can describe this kind of thing. But, either Apple doesn't use this facility, it isn't written to crash reports, or most likely both.
You can verify this behavior by using atos or dwarfdump to symbolication the address 0x0000000102c92748. My bet is it will output exactly the same thing - line 0. In the past I've used dwarfdump to poke around here to see if there was more info encoded in the dSYM, but I didn't find anything. It was a few years ago though, so things might have changed.
Might a 3rd party crash reporter help?
They all use the dSYM to symbolicate, so they cannot have more information than is contained in that file. It could be worth a shot, regardless, but I doubt you'll get anywhere on the line 0 thing.
However, they probably will be able to symbolicate the frames from libswiftCore.dylib, which could be very helpful.
Why did this crash happen?
This is the million dollar question.
I'd like to see the actual crash details. My guess is it is an illegal instruction, because you've crashed inside a swift runtime library. What's likely happening is the runtime has tripped on some kind of illegal state. Unwrapping a nil Optional could definitely be it. Could also be an out of bounds Range operation. I think that out-of-bounds array indexes might also fail in this way, but off the top of my head, I'm not sure.
What I would do is just take a close look at what's going on in TableViewController.sendSmsMessage(sender:). Pay close attention to the things listed above, particularly if it is interacting with any generic standard library functions.
I would also make an attempt to symbolicate those libswiftCore.dylib frames. Again, you can use atos for this, just by pointing it at the library itself and using the load address. I'm unsure where Xcode keeps the Swift libraries internally, so you might just use the copy of the lib that was bundled with your app.
Good luck!

MAC Sierra 10.12 use xcode to debug view hierarchy get empty, not show the view

I recently encountered a problem, I use VMware to install the mac system, the use of xcode debug view hierarchy function, encountered a blank interface, but the left shows the view inside the UIViews elements, the middle is a blank nothing, Do not know why, hope to get everyone's answer.
Thank you
I am using a desktop, no wireless module。When I use Reveal to debug, also met the same problem. still empty and don't show any views.
The below picture is the problem I met :
I use Reveal and also met the same problem:
This is not an answer.
It's just what I found is pretty long and doesn't fit in a comment.
I am running Catalina 10.15.4 within qemu.
Thus, I guess this problem is related to virtual machine.
"Show Clipped Content" didn't work for me.
But after I clicked "Debug Memory Graph", xcode crashed and gave me:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libc++abi.dylib 0x00007fff647be0c1 __dynamic_cast + 23
1 com.apple.Jet 0x00007fff52785675 jet_context_OpenGL::create_program(jet_function*, jet_function*) + 69
2 com.apple.SpriteKit 0x00007fff3a3f4127 SKCRenderer::loadShaders() + 441
3 com.apple.SpriteKit 0x00007fff3a3f6bcb SKCRenderer::SKCRenderer(std::__1::shared_ptr<jet_context>) + 767
4 com.apple.SpriteKit 0x00007fff3a32513e -[SKView _ensureRenderer] + 69
5 com.apple.SpriteKit 0x00007fff3a325791 -[SKView _commonInit] + 648
6 com.apple.SpriteKit 0x00007fff3a32b475 -[SKView initWithFrame:] + 109
7 com.apple.DTGraphKitSpriteKitAssets 0x000000013b82267c 0x13b811000 + 71292
8 com.apple.AppKit 0x00007fff2a76ecc7 -[NSView init] + 44
9 com.apple.dt.instruments.DTGraphKit 0x0000000111167d5e _sharedInit + 78
10 com.apple.dt.instruments.DTGraphKit 0x0000000111167f38 -[DTObjectGridGraph initWithCoder:] + 56
11 com.apple.dt.IDE.IDEInterfaceBuilderCocoaIntegration 0x00000001200fceda IBCreateSwappedObjectForCoder + 78
12 com.apple.dt.IDE.IDEInterfaceBuilderCocoaIntegration 0x00000001200fccf1 -[NSClassSwapper(IBNSClassSwapperPrivate) ibSwizzledInitWithCoder:] + 63
13 com.apple.UIFoundation 0x00007fff5e4a7650 UINibDecoderDecodeObjectForValue + 747
14 com.apple.UIFoundation 0x00007fff5e4a784b UINibDecoderDecodeObjectForValue + 1254
15 com.apple.UIFoundation 0x00007fff5e4a7358 -[UINibDecoder decodeObjectForKey:] + 251
16 com.apple.AppKit 0x00007fff2a70722c -[NSView initWithCoder:] + 1846
17 com.apple.dt.DVTStructuredLayoutKit 0x00000001060dae07 -[DVTLayoutView_ML initWithCoder:] + 42
18 com.apple.dt.DVTUserInterfaceKit 0x00000001061f356e -[DVTBorderedView initWithCoder:] + 97
19 com.apple.dt.IDE.IDEInterfaceBuilderCocoaIntegration 0x00000001200fceda IBCreateSwappedObjectForCoder + 78
20 com.apple.dt.IDE.IDEInterfaceBuilderCocoaIntegration 0x00000001200fccf1 -[NSClassSwapper(IBNSClassSwapperPrivate) ibSwizzledInitWithCoder:] + 63
21 com.apple.UIFoundation 0x00007fff5e4a7650 UINibDecoderDecodeObjectForValue + 747
22 com.apple.UIFoundation 0x00007fff5e4a7358 -[UINibDecoder decodeObjectForKey:] + 251
23 com.apple.AppKit 0x00007fff2a6cb981 -[NSNibConnector initWithCoder:] + 89
24 com.apple.AppKit 0x00007fff2a6cb8c4 -[NSNibOutletConnector initWithCoder:] + 414
…
Thus, I guess it is related to OpenGL.
I tried to see if it would work with a real device (above happened on an iOS simulator).
But I failed to connect my iPhone to the guest macOS.
It stuck with the hosting Ubuntu.
Gonna to dig deeper …
Your view might be swapped out from visible screen (maybe you scrolled right/left or up/down more).
So try scrolling vertically and/or horizontally to make your view inside your viewable area.
Besides you can try clicking the orient to 3D button that resets your view in the middle of your editor's screen. Here is a screenshot for better understanding:

Live app crash on UIImage imageNamed:

I'm having some weird issues with our app, it crashes when using some UIImage.
I get the image with [UIImage imageNamed:#"imageName"] from the image asset.
But on some device it returns nil which crash my app, but It should not be nil.
I've already checked and its running on the main thread, there is enough memory left (although it was running low).
The image is PDF as single vector image in the image assets, this should create the correct sizes of the images.
Can any one give me any pointers on how to resolve this issue?
Thread : Crashed: com.apple.main-thread
0 CoreFoundation 0x1844d7108 CFDataGetBytePtr + 36
1 Foundation 0x18545a848 bytesInEncoding + 204
2 CoreFoundation 0x1844e88d4 -[__NSCFString UTF8String] + 80
3 CoreUI 0x18d6827c0 -[CUIStructuredThemeStore _canGetRenditionWithKey:isFPO:lookForSubstitutions:] + 780
4 CoreUI 0x18d6a5614 -[CUICatalog _resolvedRenditionKeyFromThemeRef:withBaseKey:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:] + 1484
5 CoreUI 0x18d6a4784 -[CUICatalog namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 148
6 UIKit 0x18a3df338 __98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 424
7 UIKit 0x18a3df0d8 -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 212
8 UIKit 0x18a4f1698 -[UIImageAsset imageWithTraitCollection:] + 404
9 UIKit 0x18a3df7c0 -[_UIAssetManager imageNamed:withTrait:] + 276
10 UIKit 0x189e7277c +[UIImage imageNamed:inBundle:compatibleWithTraitCollection:] + 220
11 UIKit 0x189ccb47c +[UIImage imageNamed:] + 124
12 Speakap 0x1000bef50 -[LoadingView commonInit] (LoadingView.m:74)
13 Speakap 0x1000beabc -[LoadingView initWithFrame:] (LoadingView.m:28)
14 Speakap 0x1001348dc -[BaseTableViewController viewDidLoad] (BaseTableViewController.m:32)
15 Speakap 0x1001570d4 -[BaseMessageViewController viewDidLoad] (BaseMessageViewController.m:66)
16 Speakap 0x10014aa34 -[MessageViewController viewDidLoad] (MessageViewController.m:37)
17 UIKit 0x189b8c098 -[UIViewController loadViewIfRequired] + 996
18 UIKit 0x189ba4350 -[UIViewController __viewWillAppear:] + 132
19 UIKit 0x189d3dfb4 -[UINavigationController _startCustomTransition:] + 1052
20 UIKit 0x189c4a190 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
21 UIKit 0x189c49e6c -[UINavigationController __viewWillLayoutSubviews] + 60
22 UIKit 0x189c49dd4 -[UILayoutContainerView layoutSubviews] + 208
23 UIKit 0x189b877ac -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 644
24 QuartzCore 0x189386b58 -[CALayer layoutSublayers] + 148
25 QuartzCore 0x189381764 CA::Layer::layout_if_needed(CA::Transaction*) + 292
26 QuartzCore 0x189381624 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
27 QuartzCore 0x189380cc0 CA::Context::commit_transaction(CA::Transaction*) + 252
28 QuartzCore 0x189380a08 CA::Transaction::commit() + 512
29 UIKit 0x189b7d9d8 _afterCACommitHandler + 180
30 CoreFoundation 0x1845afbd0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
31 CoreFoundation 0x1845ad974 __CFRunLoopDoObservers + 372
32 CoreFoundation 0x1845adda4 __CFRunLoopRun + 928
33 CoreFoundation 0x1844dcca0 CFRunLoopRunSpecific + 384
34 GraphicsServices 0x18f718088 GSEventRunModal + 180
35 UIKit 0x189bf4ffc UIApplicationMain + 204
36 Speakap 0x100162b24 main (main.m:14)
37 libdyld.dylib 0x19990a8b8 start + 4
I've experienced some "trouble" in memory management using [UIImage imageNamed:#""] within low memory context.
As the documentation says:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/clm/UIImage/imageNamed:
Discussion
This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method locates and loads the image data from disk or asset catalog, and then returns the resulting object. In iOS 9 and later, this method is thread safe.
I don't know on which OS the crash happens, but it can be an idea.
Other point, does it still happens if your replace imageNamed: by imageWithContentOfFile: or initWithContentOfFile: ?
The memory management is different (no system cache):
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/initWithContentsOfFile:
Discussion
This method loads the image data into memory and marks it as purgeable. If the data is purged and needs to be reloaded, the image object loads that data again from the specified path.
https://github.com/rickytan/RTImageAssets
install above plugin to xcode and go to file -> imageAssets ->Generate Missing assets.i will generate all missing images.
The only possibility I can see here, is that a specific device might not have the proper file. For example, if the device has Retina display and there is no #2x image in the image asset then it will be returned as nil etc.
My suggestion is to make sure all required sizes are actually exist inside the image asset + make sure to use asset group name for the imageNamed: parameter.
Also, are you testing it over various simulators or real devices?
It may possible that you are using hight resolution image & check on iPhone 4/4s or vise-a-versa.
Add all the sizes of images in image assets & then check for the image, whether it returns nil or not.
No need to mention #2x,#3x if we are using image assets,it will automatically take appropriate size from image assets.

Debug stack trace?

We received the stack trace below from Flurry. It was captured from a user's device, and we have no way of tracing it. It doesn't list lines from our code base ... how can we troubleshoot the stack trace and isolate the problem?
Full Stack Trace:
0 libGPUSupportMercury.dylib 0x34d068f6 <redacted> + 9
1 IMGSGX535GLDriver 0x2f04050f <redacted> + 122
2 GLEngine 0x32515a01 <redacted> + 172
3 GLEngine 0x3251590f _gliPresentViewES + 134
4 OpenGLES 0x325200cd <redacted> + 64
5 SpriteKit 0x32990191 -[SKView _renderContent] + 1216
6 libdispatch.dylib 0x3af1381f <redacted> + 22
7 libdispatch.dylib 0x3af25dd7 <redacted> + 26
8 SpriteKit 0x3298fca3 -[SKView renderContent] + 82
9 SpriteKit 0x3298d633 <redacted> + 130
10 SpriteKit 0x329b00eb -[SKDisplayLink _callbackForNextFrame:] + 254
11 QuartzCore 0x32766df3 <redacted> + 98
12 QuartzCore 0x32766b9d <redacted> + 344
13 IOMobileFramebuffer 0x354df75d <redacted> + 104
14 IOKit 0x30f69451 _IODispatchCalloutFromCFMessage + 248
15 CoreFoundation 0x3023eef9 <redacted> + 136
16 CoreFoundation 0x30249ab7 <redacted> + 34
17 CoreFoundation 0x30249a53 <redacted> + 346
18 CoreFoundation 0x30248227 <redacted> + 1398
19 CoreFoundation 0x301b2f4f _CFRunLoopRunSpecific + 522
20 CoreFoundation 0x301b2d33 _CFRunLoopRunInMode + 106
21 GraphicsServices 0x350b7663 _GSEventRunModal + 138
22 UIKit 0x32afe16d _UIApplicationMain + 1136
23 <OurClassName> 0x000af494 __mh_execute_header + 345236
24 libdyld.dylib 0x3af38ab7 <redacted> + 2
First, you need to get the base address for each of the modules listed on the left side (your app, plus every system library), because of Address Space Layout Randomization (ASLR). Many in-app stack trace reporting tools like PLCrashReporter can store this information in their report.
Next, you need to get the debug symbols for each module. For your app, when you build, it should produce a .dSym file, which contains the information that allows you to get the method and line numbers from the address. You need to make sure to get the exact .dSym that corresponds to the build that produced the crash, because each build is different.
For system libraries, the debug symbols are downloaded by Xcode the first time you connect a device to Xcode using a particular build of the OS. They are stored in /Users/<yourusername>/Library/Developer/Xcode/iOS DeviceSupport/. Note that sometimes versions of the OS will have multiple builds (betas, or different build for different devices); you need to get the OS build that the crash happened on, which means your stack trace will also need to store that information. It also needs to be an OS build that your Xcode has seen or else it won't have downloaded the information. For system modules, you will only get the function name and not the line number (which wouldn't be useful anyway since they are not open source).
Then, you can use the tool atos, give it an address, a load address (the base address of the module at issue), the architecture (for an app that includes code for multiple architectures), and it will output the symbol information for that address.

Crash in TextInput - how to debug?

I'm getting crash reports for my iOS app with the following or similar stack in the crashed thread:
0 TextInput 0x0003149a TIInputManager::apply_case_changes_to_result(std::vector >&, KB::Hashmap const&, std::vector > const&) const + 402
1 TextInput 0x00030bf3 TIInputManager::lookup() + 863
2 TextInput 0x000307ad TIInputManager::autocorrection() + 61
3 TextInput 0x00042d21 -[TIKeyboardInputManagerZephyr autocorrection] + 137
4 UIKit 0x0011a319 -[UIKeyboardImpl generateCandidatesWithOptions:] + 377
5 UIKit 0x00133071 -[UIKeyboardImpl addInputString:fromVariantKey:] + 2597
6 UIKit 0x00130f8d -[UIKeyboardImpl handleKeyEvent:] + 1453
7 UIKit 0x001308b7 -[UIKeyboardLayoutStar sendStringAction:forKey:isPopupVariant:] + 487
8 UIKit 0x0012f3ad -[UIKeyboardLayoutStar touchUp:] + 3101
9 UIKit 0x0012e737 -[UIKeyboardLayout touchesEnded:withEvent:] + 387
10 UIKit 0x000165f9 -[UIWindow _sendTouchesForEvent:] + 525
11 UIKit 0x00003809 -[UIApplication sendEvent:] + 381
12 UIKit 0x00003123 _UIApplicationHandleEvent + 6155
13 GraphicsServices 0x000065a3 _PurpleEventCallback + 591
14 GraphicsServices 0x000061d3 PurpleEventCallback + 35
15 CoreFoundation 0x00097173 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
16 CoreFoundation 0x00097117 __CFRunLoopDoSource1 + 139
17 CoreFoundation 0x00095f99 __CFRunLoopRun + 1385
18 CoreFoundation 0x00008ebd CFRunLoopRunSpecific + 357
19 CoreFoundation 0x00008d49 CFRunLoopRunInMode + 105
20 GraphicsServices 0x000052eb GSEventRunModal + 75
21 UIKit 0x00057301 UIApplicationMain + 1121
22 MyApp 0x0000294b main (main.mm:8)
Only the bottom-most line (main) is mine. It looks like the crash is somewhere in an touch up event handler within the text input framework, and it has to do with autocorrect.
Those crashes come with disheartening consistency - this looks like a subtle bug of mine, not that of iOS itself. The call stack is inconsistent - sometimes it ends in UIKit, sometimes in libobjc. The iOS version, however, seems to be consistently 6.x.
Any idea how to debug this, please?
EDIT: SIGSEGV/SEGV_ACCERR in thread 0. The error address varies - sometimes, it's zero, sometimes not.
This is actually an error with Apple. Go into your Settings on the simulator (the Settings app on the sim, that is) and turn off auto correction.
I've seen the same on iOS 6.1.3 (twice) and 6.1.4 (once), all in the field reported as crashlogs. All seem to be nil pointer dereferences deep within Apple's C++ code for . I don't think that there is anything that we can do beyond filing a bug report with Apple (I've raised one listed as: 15573020). Apple treat duplicate reports as an indicator of prioritisation of bugs so if you have suffered I suggest that you add a report at https://bugreport.apple.com and reference the report I have provided.

Resources