iOS8 / iPhone6+ XPC crash - ios

I have an app build on the iOS8 SDK which I archive and then sign for adhoc distribution.
This has been working for 2 years on all devices with various updates. Now I have an iPhone 6 plus.
The app ran fine the first after a new install but now it keeps crashing with error:
"XPC API Misuse: Given object not of required type"
This happens before it gets into didFinishLaunchingWithOptions
Call stack:
Thread 0 name: XPC API Misuse: Given object not of required type. Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libxpc.dylib 0x0000000197dd99d8 _xpc_api_misuse + 60
1 libxpc.dylib 0x0000000197dd99d4 _xpc_api_misuse + 56
2 libxpc.dylib 0x0000000197dc9ae8 xpc_dictionary_set_value + 88
3 libxpc.dylib 0x0000000197dc5538 xpc_dictionary_set_string + 48
4 CoreFoundation 0x0000000186e4b590 _CFXNotificationRemoveObservers + 912
5 Foundation 0x0000000187d1ff20 -[NSNotificationCenter removeObserver:name:object:] + 252
6 UIKit 0x000000018b8588e4 -[UITableView dealloc] + 96
7 UIKit 0x000000018b6bf510 -[UIView(Hierarchy) removeFromSuperview] + 696
8 UIKit 0x000000018b79cb24 -[UIScrollView removeFromSuperview] + 76
9 UIKit 0x000000018b6c219c -[UIView dealloc] + 444
10 CoreFoundation 0x0000000186e217e4 CFRelease + 520
11 CoreFoundation 0x0000000186e2dda4 -[__NSArrayM dealloc] + 148
12 libobjc.A.dylib 0x0000000197599720 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 560
13 CoreFoundation 0x0000000186e25400 _CFAutoreleasePoolPop + 24
14 Foundation 0x0000000187d1f180 -[NSAutoreleasePool release] + 144
15 UIKit 0x000000018b72f9ac -[UIApplication _run] + 584
16 UIKit 0x000000018b72a980 UIApplicationMain + 1484
17 HelloWorld 0x000000010000636c main (main.m:16)
18 libdyld.dylib 0x0000000197beea04 start + 0
Can anyone help?

I fixed the crash in my own app but I can't 100% pin point the root cause. I suspect it was memory corruption or over retaining an object.
The key was [UITableView dealloc] I implemented dealloc in my table view to see where problem was occurring. I eventually traced it down to a UITableViewCell instantiated from a .xib file. This particular .xib contained multiple UITableViewCells. After giving each table view it's own .xib the crash disappeared.

for me, I got xpc api Misuse crash when I ran some video editing code from the simulator!(iOS 13), the problem doesn't appear on real device.

Related

In iPad pro 11.2.5 App get crashed

In my app, I have used one textfield. When tap on textfield the device keyboard will appear and than I type some text in that textfield. On that time the app get crashed in iPad Pro 11.2.5 version. I don't know why the app getting crashed because the same code works perfect in iPad Pro 10.3 version. Please review the my crash analytics report below
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x184410430 objc_msgSend + 16
1 CoreFoundation 0x18514513c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
2 CoreFoundation 0x1851446dc _CFXRegistrationPost + 420
3 CoreFoundation 0x185144440 ___CFXNotificationPost_block_invoke + 60
4 CoreFoundation 0x1851c1e24 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
5 CoreFoundation 0x18507ad60 _CFXNotificationPost + 380
6 Foundation 0x185aa7348 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
7 UIFoundation 0x18f8c4570 -[NSTextStorage processEditing] + 240
8 UIFoundation 0x18f8c41d8 -[NSTextStorage endEditing] + 92
9 UIKit 0x18e914368 -[UITextInputController _insertText:fromKeyboard:] + 488
10 UIKit 0x18e9136d0 -[UITextInputController insertText:] + 400
11 UIKit 0x18ead3518 -[UIFieldEditor insertFilteredText:] + 968
12 UIKit 0x18f3eb3a0 -[UITextField insertFilteredText:] + 104
13 UIKit 0x18e91343c -[UIKeyboardImpl insertText:] + 136
14 UIKit 0x18ebd735c -[UIKeyboardImpl performKeyboardOutput:] + 756
15 UIKit 0x18ebd665c __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 256
16 UIKit 0x18f431fac -[UIKeyboardTaskEntry execute:] + 192
17 UIKit 0x18e7975f0 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 384
18 Foundation 0x185baf2e4 __NSThreadPerformPerform + 340
19 CoreFoundation 0x18515b77c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
20 CoreFoundation 0x18515b6fc __CFRunLoopDoSource0 + 88
21 CoreFoundation 0x18515af84 __CFRunLoopDoSources0 + 204
22 CoreFoundation 0x185158b5c __CFRunLoopRun + 1048
23 CoreFoundation 0x185078c58 CFRunLoopRunSpecific + 436
24 GraphicsServices 0x186f24f84 GSEventRunModal + 100
25 UIKit 0x18e7d15c4 UIApplicationMain + 236
26 Q App 0x1050b756c main (main.m:16)
27 libdyld.dylib 0x184b9856c start + 4
As my crash reports, I didn't use NotificationCenter/observer in that screen. But the crash reports are showing in the NotificationCenter. Please Any know the solution for this ?
Note: The following is without knowing all required details because you did not provide any source code on how you implemented the feature nor does the crash report shown here contain any information about the exception code/signal being thrown.
The top frame shows the method objc_msgSend being invoked. This method is always used when the runtime tries to send a message (method) to an object. And crashes in this method usually mean the object doesn't exist any longer which means it was deallocated but your code still holds a reference.
So this looks like a memory management issue in your code. Without your actual implementation it is impossible to provide any meaningful help.
The best way to debug this is to run the app in debug mode and the device attached to Xcode and get more details. The Instrument tools can also help finding out where the problem is.

iOS app crashing in release but not in development and Swift symbols are not resolved

My app is working perfectly fine in development but switching to production / AdHoc release it crashes on the transition to the third UIViewController of my application flow.
Between the build there shouldn't be any difference. I have retrieved the log from the Devices window:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000d49ac
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MYAPP 0x00000001000d49ac 0x100010000 + 805292
1 UIKit 0x00000001868a8954 -[UIViewController loadViewIfRequired] + 688
2 UIKit 0x00000001868a8664 -[UIViewController view] + 28
3 UIKit 0x0000000186f9c1cc -[_UIFullscreenPresentationController _setPresentedViewController:] + 72
4 UIKit 0x0000000186ba378c -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 116
5 UIKit 0x0000000186bbeb4c -[UIViewController _presentViewController:withAnimationController:completion:] + 1968
6 UIKit 0x0000000186bc0f64 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 116
7 UIKit 0x0000000186995c48 -[UIViewController presentViewController:animated:completion:] + 212
8 MYAPP 0x0000000100090dcc 0x100010000 + 527820
9 MYAPP 0x0000000100090bd0 0x100010000 + 527312
10 PromiseKit 0x000000010032a9f4 0x1002e8000 + 272884
11 PromiseKit 0x00000001002ee820 0x1002e8000 + 26656
12 libdispatch.dylib 0x00000001936c1990 _dispatch_call_block_and_release + 20
13 libdispatch.dylib 0x00000001936c1950 _dispatch_client_callout + 12
14 libdispatch.dylib 0x00000001936c6208 _dispatch_main_queue_callback_4CF + 1604
15 CoreFoundation 0x00000001820522e8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
16 CoreFoundation 0x0000000182050390 __CFRunLoopRun + 1488
17 CoreFoundation 0x0000000181f7d1f0 CFRunLoopRunSpecific + 392
18 GraphicsServices 0x000000018b39f6f8 GSEventRunModal + 164
19 UIKit 0x000000018690e108 UIApplicationMain + 1484
20 MYAPP 0x00000001000be820 0x100010000 + 714784
21 libdyld.dylib 0x00000001936eea04 start + 0
What is bugging me:
There is a clear inconsistency between the environments I am working on.
The calls from MYAPP doesn't seem to be linked to any component / method call. I'm working with Swift maybe it does cause problem to resolve symbols. Which could make sense since PromiseKit calls are also unresolved.
I have no idea about how to debug this, not even about how to put log everywhere (because I wouldn't know how to get them).
Any help is welcome!
In Build settings, try changing Swift compiler -> Optimization Level -> Release to None. There's still a bug where sometimes the compiler messes up closures when optimizations are on. Maybe that's what's happening to you.

iOS MagicalRecord Crash on launch

I'm having an issue where some users are getting a crash on launch in my native iOS app using MagicalRecord (shorthand) v2.2.
This is not a classic database migration issue as firstly it doesn't occur for all users, and secondly the database schema has not been changed (I have git logs proving this and just in case I tried to reproduce after making some db changes but was not successful).
Deleting and recreating the database does seem to work however as the fallback code in the app clears and recreates the database if it has detected that it has crashed due to this issue previously. The crash logs indicate that this works as there is a 1 to 1 ratio of unique devices and number of crashes.
All that happens on launch related to the db is the following:
[MagicalRecord setErrorHandlerTarget:self action:#selector(handleCoreDataError:)];
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"xxx.sqlite"];
The stack trace on the main thread:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37d3f626 objc_msgSend + 5
1 Foundation 0x2dec102d -[NSError dealloc] + 60
2 libobjc.A.dylib 0x37d44b6b objc_object::sidetable_release(bool) + 174
3 libobjc.A.dylib 0x37d450d3 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
4 CoreFoundation 0x2d4d24c1 _CFAutoreleasePoolPop + 16
5 Foundation 0x2decb8e3 -[NSAutoreleasePool drain] + 122
6 CoreData 0x2d312fbf -[NSManagedObjectContext save:] + 942
7 xxx 0x00249223 __70-[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:]_block_invoke3 (NSManagedObjectContext+MagicalSaves.m:64)
8 CoreData 0x2d3769cd developerSubmittedBlockToNSManagedObjectContextPerform + 88
9 libdispatch.dylib 0x3821ed3f _dispatch_client_callout + 22
10 libdispatch.dylib 0x382216c3 _dispatch_main_queue_callback_4CF + 278
11 CoreFoundation 0x2d569681 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
12 CoreFoundation 0x2d567f4d __CFRunLoopRun + 1308
13 CoreFoundation 0x2d4d2769 CFRunLoopRunSpecific + 524
14 CoreFoundation 0x2d4d254b CFRunLoopRunInMode + 106
15 GraphicsServices 0x3243f6d3 GSEventRunModal + 138
16 UIKit 0x2fe31891 UIApplicationMain + 1136
17 xxx 0x0002e3cc main (main.m:18)
Well, this error seems like you're overreleasing the error object. Are you explicitly calling [error release] or [error autorelease] somewhere?

How to find, where is the crash happen - ios

I'm running my ios app in ipad 1, the following crash happen sometime while app is running, i don't know where the crash happen. This mostly happen in ios 5.1.1 . Here the crash log,
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xf0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3387ef78 objc_msgSend + 16
1 UIKit 0x333ffa3a -[UIViewController unloadViewForced:] + 254
2 UIKit 0x335473a6 -[UIViewController purgeMemoryForReason:] + 58
3 Foundation 0x3507a4f8 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 12
4 CoreFoundation 0x35c2c540 ___CFXNotificationPost_block_invoke_0 + 64
5 CoreFoundation 0x35bb8090 _CFXNotificationPost + 1400
6 Foundation 0x34fee3e4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 60
7 Foundation 0x34fefc14 -[NSNotificationCenter postNotificationName:object:] + 24
8 UIKit 0x335120e6 -[UIApplication _performMemoryWarning] + 74
9 UIKit 0x335121e0 -[UIApplication _receivedMemoryNotification] + 168
10 libdispatch.dylib 0x33ffb252 _dispatch_source_invoke + 510
11 libdispatch.dylib 0x33ff8b1e _dispatch_queue_invoke$VARIANT$up + 42
12 libdispatch.dylib 0x33ff8e64 _dispatch_main_queue_callback_4CF$VARIANT$up + 152
13 CoreFoundation 0x35c332a6 __CFRunLoopRun + 1262
14 CoreFoundation 0x35bb649e CFRunLoopRunSpecific + 294
15 CoreFoundation 0x35bb6366 CFRunLoopRunInMode + 98
16 GraphicsServices 0x33951432 GSEventRunModal + 130
17 UIKit 0x3338ecce UIApplicationMain + 1074
18 MY Game 0x00079a90 0x75000 + 19088
19 MY Game 0x00079a50 0x75000 + 19024
As i understand from crash log, crash not happen due to my code. It's due low memory. Is that correct? How to find where the crash happen? Any suggestions.
As i understand from crash log, crash not happen due to my code. It's due low memory. Is that correct?
No, that's not correct.
Low memory is being reported, but your view controller is not responding properly. The most common cause of this is a retain cycle - see UIViewController purgeMemoryForReason: Crashing on iOS 5. In that answer, the retain cycle is in SVPullToRefresh , but yours could be elsewhere. The most common cause of retain cycles is not setting a delegate property to weak.
Once you figure out where the issue is, you can set breakpoints in viewDidUnload and ``didReceiveMemoryWarning`, simulate a memory warning, and step through your code to find the error.
Symbolication
Additionally, this crash report isn't symbolicated. Typically you'll want to symbolicate your crash report first. For example, see these lines:
18 MY Game 0x00079a90 0x75000 + 19088
19 MY Game 0x00079a50 0x75000 + 19024
In this case, as pointed out by Kerni, those two will just show start and main, so they won't help you in this instance. But generally, you should symbolicate your crash reports. (Search for "Xccode symbolicate crash logs" if you don't know how to do this.)

iOS: Crashlytics Crash Reports and Free RAM

In one of our iPhone apps, we have gotten a few Crashlytics crashes that we have, so far, been unable to reproduce. However, on closer inspection, I noticed a bit of a trend...
Crash 1: -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
Free RAM: 10%
Crash 2: -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
Free RAM: 8%
Crash 3: HostBase::lock()
Free RAM: 8%
Crash 4:-[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
Free RAM: 22%
Does the amount of free RAM mean anything? Can we be sure that these are actual crashes and not our app getting killed by the OS due to low memory? Does Crashlytics send crash reports if the app crashes while in the background?
Added a couple stack traces...
Exception Type: SIGSEGV, Nav Crashes
0 libobjc.A.dylib
objc_msgSend + 15
1 UIKit ✭
-[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 274
2 UIKit
-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 158
3 UIKit
-[UIViewAnimationState animationDidStop:finished:] + 50
4 QuartzCore
CA::Layer::run_animation_callbacks(void*) + 208
5 libdispatch.dylib
_dispatch_client_callout + 22
6 libdispatch.dylib
_dispatch_main_queue_callback_4CF$VARIANT$mp + 224
7 CoreFoundation
__CFRunLoopRun + 1290
8 CoreFoundation
CFRunLoopRunSpecific + 356
9 CoreFoundation
CFRunLoopRunInMode + 104
10 GraphicsServices
GSEventRunModal + 74
11 UIKit
UIApplicationMain + 1120
Exception Type: SIGSEGV, HostLock crash
0 libobjc.A.dylib
objc_msgSend + 15
1 CFNetwork ✭
HostBase::lock() + 14
2 CFNetwork
DispatchHost::performInvocation(void const*) + 12
3 CFNetwork
__setupTCPConnection_block_invoke_2 + 290
4
...
libsystem_network.dylib
__tcp_connection_notify_complete_block_invoke_1 + 18
7 libsystem_c.dylib
_pthread_wqthread + 294
8% memory can be a lot, I highly doubt that this is an issue. I don't know if they send crashes while running in the background, you have to ask them directly since their SDK is not open source.
Both exception stack traces you added hint at a memory problem.
The first one looks like it tries to call a delegate at the end of an animation of an object, which does not exist any more.
The second one looks like a similar problem, where the completion block is accessing an object that is gone. So you might check your blocks for such patterns.

Resources