Understanding crash report from iOS review process - ios

I'm trying to upload an app to the iOS App Store but I'm getting rejection due to crashes (which I can't reproduce with the several simulations / devices I have.
I'm attaching here the crash reports.
The problem that I have is that I can't re-symbolicate the crash correctly and all I can get when I try to right click and choose re-symbolicate them is the following:
{"app_name":"Livycs","timestamp":"2019-10-21 13:36:46.22 -0700","app_version":"1.3","slice_uuid":"4ceb4db7-568a-3a47-a8e9-0e6d8ff33b2b","adam_id":1054637602,"build_version":"12","bundleID":"me.linktree.Livycs","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 13.1.3 (17A878)","incident_id":"B26974A6-3E7F-40F4-836A-BC4FF36D1219","name":"Livycs"}
Incident Identifier: B26974A6-3E7F-40F4-836A-BC4FF36D1219
CrashReporter Key: f76f6829cc13ca447c49f923305d7b23085e37fd
Hardware Model: xxx
Process: Livycs [394]
Path: /private/var/containers/Bundle/Application/1ADC7177-F01D-4C60-B624-730592A5C45A/Livycs.app/Livycs
Identifier: me.linktree.Livycs
Version: 12 (1.3)
AppStoreTools: 11A1002b
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: me.linktree.Livycs [530]
Date/Time: 2019-10-21 13:36:46.1480 -0700
Launch Time: 2019-10-21 13:34:25.7023 -0700
OS Version: iPhone OS 13.1.3 (17A878)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x1a450298c __exceptionPreprocess + 220
1 libobjc.A.dylib 0x1a422b0a4 objc_exception_throw + 55
2 CoreFoundation 0x1a43f8054 +[NSException raise:format:] + 107
3 UIKitCore 0x1a7eb70f8 UISearchDisplayControllerNoLongerSupported + 247
4 UIKitCore 0x1a7eb73fc -[UISearchDisplayController initWithCoder:] + 83
5 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
6 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
7 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
8 UIKitCore 0x1a7efe6e4 -[UIViewController initWithCoder:] + 1035
9 UIKitCore 0x1a81b9c2c -[UIClassSwapper initWithCoder:] + 2455
10 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
11 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
12 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
13 UIKitCore 0x1a81b8edc -[NSCoder+ 6917852 (UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent:forKey:] + 315
14 UIKitCore 0x1a7efe89c -[UIViewController initWithCoder:] + 1475
15 UIKitCore 0x1a7e41a84 -[UITabBarController initWithCoder:] + 79
16 UIKitCore 0x1a81b9c2c -[UIClassSwapper initWithCoder:] + 2455
17 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
18 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
19 UIKitCore 0x1a81bdc50 -[UIRuntimeConnection initWithCoder:] + 127
20 UIFoundation 0x1a7aab838 UINibDecoderDecodeObjectForValue + 727
21 UIFoundation 0x1a7aaba6c UINibDecoderDecodeObjectForValue + 1291
22 UIFoundation 0x1a7a47ec8 -[UINibDecoder decodeObjectForKey:] + 315
23 UIKitCore 0x1a81b8cc8 -[NSCoder+ 6917320 (UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 487
24 UIKitCore 0x1a81bb8b8 -[UINib instantiateWithOwner:options:] + 1111
25 UIKitCore 0x1a86617d8 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 287
26 Livycs 0x1040d44dc #objc WelcomeViewController.searchShowsAroundMeButtonClicked+ 165084 (_:) + 131
27 UIKitCore 0x1a8511a44 -[UIApplication sendAction:to:from:forEvent:] + 95
28 UIKitCore 0x1a7f556d0 -[UIControl sendAction:to:forEvent:] + 239
29 UIKitCore 0x1a7f55a34 -[UIControl _sendActionsForEvents:withEvent:] + 407
30 UIKitCore 0x1a7f54a50 -[UIControl touchesEnded:withEvent:] + 519
31 UIKitCore 0x1a854ad68 -[UIWindow _sendTouchesForEvent:] + 2323
32 UIKitCore 0x1a854c0a8 -[UIWindow sendEvent:] + 3351
33 UIKitCore 0x1a8528ae8 -[UIApplication sendEvent:] + 335
34 UIKitCore 0x1a85a023c __dispatchPreprocessedEventFromEventQueue + 5879
35 UIKitCore 0x1a85a2798 __handleEventQueueInternal + 4923
36 UIKitCore 0x1a859b60c __handleHIDEventFetcherDrain + 107
37 CoreFoundation 0x1a44807e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 23
38 CoreFoundation 0x1a4480738 __CFRunLoopDoSource0 + 79
39 CoreFoundation 0x1a447fed0 __CFRunLoopDoSources0 + 179
40 CoreFoundation 0x1a447b01c __CFRunLoopRun + 1079
41 CoreFoundation 0x1a447a8bc CFRunLoopRunSpecific + 463
42 GraphicsServices 0x1ae2e6328 GSEventRunModal + 103
43 UIKitCore 0x1a85106d4 UIApplicationMain + 1935
44 Livycs 0x1040d246c main + 156780 (SearchLocationViewController.swift:14)
45 libdyld.dylib 0x1a4305460 start + 3
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001a42faebc __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001a4216790 pthread_kill$VARIANT$mp + 112
2 libsystem_c.dylib 0x00000001a416a8a0 __abort + 112
3 libsystem_c.dylib 0x00000001a416a830 __abort + 0
4 libc++abi.dylib 0x00000001a42c37d4 __cxa_bad_cast + 0
5 libc++abi.dylib 0x00000001a42c39c4 demangling_unexpected_handler+ 6596 () + 0
6 libobjc.A.dylib 0x00000001a422b358 _objc_terminate+ 25432 () + 124
7 Livycs 0x0000000104113a94 CLSTerminateHandler() + 424596 (CLSException.mm:0)
8 libc++abi.dylib 0x00000001a42d0304 std::__terminate(void (*)+ 58116 ()) + 16
9 libc++abi.dylib 0x00000001a42cfed8 __cxa_rethrow + 144
10 libobjc.A.dylib 0x00000001a422b258 objc_exception_rethrow + 40
11 CoreFoundation 0x00000001a447a92c CFRunLoopRunSpecific + 576
12 GraphicsServices 0x00000001ae2e6328 GSEventRunModal + 104
13 UIKitCore 0x00000001a85106d4 UIApplicationMain + 1936
14 Livycs 0x00000001040d246c main + 156780 (SearchLocationViewController.swift:14)
15 libdyld.dylib 0x00000001a4305460 start + 4
The code where I think it crashes (WelcomeViewController.swift)
//
// WelcomeViewController.swift
// Livycs
//
// Created by Nir Sagiv on 03/03/2016.
// Copyright © 2016 Nir Sagiv. All rights reserved.
//
import UIKit
class WelcomeViewController: UIViewController {
#IBOutlet weak var showsRoundMeButton: UIButton!
#IBOutlet weak var showsByLocationBotton: UIButton!
#IBOutlet weak var iosVersion: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
showsRoundMeButton.layer.cornerRadius = 10
showsByLocationBotton.layer.cornerRadius = 10
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.backgroundColor = UIColor.clear
iosVersion.text = version()
BiAnalyticsService.logEvent("MainPage", withParameter: nil)
// Do any additional setup after loading the view.
}
override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func version() -> String {
let dictionary = Bundle.main.infoDictionary!
let version = dictionary["CFBundleShortVersionString"] as! String
let build = dictionary["CFBundleVersion"] as! String
return "v\(version) (\(build))"
}
#IBAction func searchShowsAroundMeButtonClicked(_ sender: UIButton) {
BiAnalyticsService.logEvent("MainPage:searchShowsAroundMeButtonClicked", withParameter: nil)
let vc:UITabBarController = (self.storyboard?.instantiateViewController(withIdentifier: "main")) as! UITabBarController
vc.selectedIndex = 0
self.present(vc, animated: true, completion: nil)
}
#IBAction func searchShowsByLocationButtonClicked(_ sender: UIButton) {
BiAnalyticsService.logEvent("MainPage:searchShowsByLocationButtonClicked", withParameter: nil)
let vc:UITabBarController = (self.storyboard?.instantiateViewController(withIdentifier: "main")) as! UITabBarController
vc.selectedIndex = 1
self.present(vc, animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
notice that I've cleared the BiAnalyticsService.logEvent... since I was thinking it might cause problems and the code there is now:
class func logEvent( eventName : String, withParameter : Dictionary<String,String>?){
// if withParameter == nil {
// mixpanel.track(eventName, properties: staticProperties)
// } else {
// var prm = withParameter!
//
// for key in staticProperties.keys {
// prm[key] = staticProperties[key]
// }
// mixpanel.track(eventName, properties: prm)
// }
}
Any help will be appreciated

Find in code "searchdisplay", it will appear somewhere in Storyboard at the bottom of one of your old viewcontrollers, remove this SearchDisplay item, and that's all.
In my case SearchDisplay was even linked to outlet (no real outlet actually existed! nore a single compiler error!), and obviously it was not used for a long time. Crash occured only in review team or via TestFlight, but not by cable, on any device. Review team's crashreports said nothing (symbolicate always failed), thus I killed three days nd three builds until got useful report from tester.
Use TestFlight now! Multiply debug on cable is not enough It's time :-(

Starting with iOS 13 and iPad OS 13, UISearchDisplayController is unavailable to apps built with Xcode 11.
UISearchDisplayController was deprecated starting with iOS 8, and you should use UISearchController
In order to reproduce this locally, you need to test the thinned variant of your app
If you receive one of these crashes but can't reproduce it locally,
ensure that you are testing the deployed version of your app on iOS
13, either by using TestFlight, or by applying app thinning to your
Xcode archive and testing the thinned variant of your app targeted at
iOS 13 devices. By testing with the thinned variant, you will be able
to reproduce this crash. To apply app thinning to your local Xcode
archive, export the app from the Xcode Archive using either the Ad-Hoc
or Development options, and select "All compatible device variants"
for the App Thinning option. After the thinned versions are created,
you can identify the specific variant targeted at iOS 13 by reading
the App Thinning Size Report file that is part of the output, and then
install and test that thinned .ipa file.
Please see: Apple Developer Forum

Related

Fatal Exception: NSInvalidArgumentException while working with UISwitch in UITableview

AppName denotes the application name.
User reported this crash. It only came once and also not able to reproduce the same on my end. Hence not able to debug. If some one can provide some insight for the same.
Below is the Crashlytics log received.
# OS Version: 12.4.2 (16G114)
# Device: iPhone 5s
# RAM Free: 8.5%
# Disk Free: 9.6%
#0. Crashed: com.twitter.crashlytics.ios.exception
0 App Name 0x100df7388 CLSProcessRecordAllThreads + 376 (CLSProcess.c:376)
1 App Name 0x100df7770 CLSProcessRecordAllThreads + 407 (CLSProcess.c:407)
2 App Name 0x100de7474 CLSHandler + 26 (CLSHandler.m:26)
3 App Name 0x100df599c __CLSExceptionRecord_block_invoke + 198 (CLSException.mm:198)
4 libdispatch.dylib 0x1db6217d4 _dispatch_client_callout + 16
5 libdispatch.dylib 0x1db5cfc1c _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 App Name 0x100df5444 CLSExceptionRecord + 205 (CLSException.mm:205)
7 App Name 0x100df5278 CLSExceptionRecordNSException + 102 (CLSException.mm:102)
8 App Name 0x100df4e9c CLSTerminateHandler() + 258 (CLSException.mm:258)
9 libc++abi.dylib 0x1dadb0838 std::__terminate(void (*)()) + 16
10 libc++abi.dylib 0x1dadb0434 __cxa_rethrow + 144
11 libobjc.A.dylib 0x1dadbbbc8 objc_exception_rethrow + 44
12 CoreFoundation 0x1dbb72030 CFRunLoopRunSpecific + 544
13 GraphicsServices 0x1ddd7379c GSEventRunModal + 104
14 UIKitCore 0x2084f3c38 UIApplicationMain + 212
15 App Name 0x100c1ee1c main + 23 (ViewController.swift:23)
16 libdyld.dylib 0x1db6328e0 start + 4
--
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x1dbbe6190 __exceptionPreprocess
1 libobjc.A.dylib 0x1dadbb9f8 objc_exception_throw
2 CoreFoundation 0x1dbaf03b0 -[NSCache init]
3 CFNetwork 0x1dc3f4b58 -[NSURLSessionTask cancel]
4 App Name 0x100cb9fec ViewController.switchChanged(_:) (ViewController.swift)
5 App Name 0x100cbac7c #objc ViewController.switchChanged(_:) (<compiler-generated>)
6 UIKitCore 0x2084f5300 -[UIApplication sendAction:to:from:forEvent:]
7 UIKitCore 0x207f9e424 -[UIControl sendAction:to:forEvent:]
8 UIKitCore 0x207f9e744 -[UIControl _sendActionsForEvents:withEvent:]
9 UIKitCore 0x207fcb0fc -[UISwitchModernVisualElement sendStateChangeActions]
10 UIKitCore 0x207fcaa04 -[UISwitchMVEGestureTrackingSession _sendStateChangeActionsIfNecessary]
11 UIKitCore 0x207fcb7a4 -[UISwitchModernVisualElement _handleLongPressWithGestureLocationInBounds:gestureState:]
12 UIKitCore 0x20811cac4 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:]
13 UIKitCore 0x208124ccc _UIGestureRecognizerSendTargetActions
14 UIKitCore 0x208122670 _UIGestureRecognizerSendActions
15 UIKitCore 0x208121b9c -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
16 UIKitCore 0x208115c78 _UIGestureEnvironmentUpdate
17 UIKitCore 0x2081153a8 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:]
18 UIKitCore 0x208115188 -[UIGestureEnvironment _updateForEvent:window:]
19 UIKitCore 0x20852d7d0 -[UIWindow sendEvent:]
20 UIKitCore 0x20850d85c -[UIApplication sendEvent:]
21 UIKitCore 0x2085d39d4 __dispatchPreprocessedEventFromEventQueue
22 UIKitCore 0x2085d6100 __handleEventQueueInternal
23 UIKitCore 0x2085cf330 __handleHIDEventFetcherDrain
24 CoreFoundation 0x1dbb77f2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
25 CoreFoundation 0x1dbb77eac __CFRunLoopDoSource0
26 CoreFoundation 0x1dbb77794 __CFRunLoopDoSources0
27 CoreFoundation 0x1dbb726d0 __CFRunLoopRun
28 CoreFoundation 0x1dbb71fc4 CFRunLoopRunSpecific
29 GraphicsServices 0x1ddd7379c GSEventRunModal
30 UIKitCore 0x2084f3c38 UIApplicationMain
31 App Name 0x100c1ee1c main + 23 (ViewController.swift:23)
32 libdyld.dylib 0x1db6328e0 start
Below is some part of code which may give more clear picture.
case .SettingsCell:
let cell: SettingsCell = tableView.dequeueReusableCell(withIdentifier: "SettingsCell") as! SettingsCell
cell.selectionStyle = .none
cell.switchOnOff.addTarget(self, action: #selector(switchChanged(_ :)), for: .valueChanged)
Below is the function called on UISwitch button value change.
case 13:
if sender.isOn{
UserDefaultUtility.saveToUserDefault(value: true, key: Constant.UserDefaults.k_IsAnimation)
appDelegate.getPollutantAbbreviationAndGIFImages()
} else {
let networkManager = NetworkManager()
networkManager.cancelImageDownloadTask()
}
Below is the function in Network Manager:
func cancelImageDownloadTask() {
self.downloadImagesSession?.cancel()
}
Download session is URLSessionDownloadTask object declared below.
weak var downloadImagesSession: URLSessionDownloadTask?
It is allocated using below code.
self.downloadImagesSession = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
}
That seems to be the problem:
let networkManager = NetworkManager()
networkManager.cancelImageDownloadTask()
You just initialize a NetworkManager instance, and then directly try to cancel a task. But you cannot cancel a task which isn't started yet

App crash on viewDidDisappear

There is a very strange crash that occurs only on 5, 5s and SE models with iOS 10.2. Firebase says that 100% of crashes happened in background.
I got able to exactly reproduce the stack of crash (but not the crash itself on the simulator) and only figured out that it happens when the user quit an app. Seems like no other code of viewDidDisappear get called on real crash, because the stack changes in this case.
Actually, the line that mentioned in crash report goes straight after
super.viewDidDisappear(animated) and it is blank…
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
self.keyboardAvoiding.endAvoiding()
}
KeyboardAvoiding
func endAvoiding()
{
self.avoiding = false
// Update view frame
updateConstraint(nil)
}
private func updateConstraint(_ keyboardFrame: CGRect?, animationDuration: TimeInterval? = 0.0)
{
// Disable animation
let state = UIView.areAnimationsEnabled
UIView.setAnimationsEnabled(false)
// Force to recalculate view frame if needed (without animation)
self.view.superview?.layoutIfNeeded()
// Restore previous animation state
UIView.setAnimationsEnabled(state)
if let keyboardFrame = keyboardFrame
{
// Decrease view frame
self.constraint.constant = keyboardFrame.height
}
else {
// Reset bottom constraint to initial value
self.constraint.constant = self.initialConstraintConstant
}
// Layout superview
UIView.animate(withDuration: animationDuration ?? 0.0, animations: {
self.view.superview?.layoutIfNeeded()
if let keyboardAvoidingScrollView = self.view.firstViewOfClass(TPKeyboardAvoidingScrollView.self)
{
// Scroll to active text field if scroll view frame changed
keyboardAvoidingScrollView.scrollToActiveTextField()
}
})
}
Here is a crash report:
Hardware Model: iPhone6,2
Code Type: ARM-64
Parent Process: ??? [1]
OS Version: iPhone OS 10.2 (14C92)
Exception Type: SIGTRAP
Exception Codes: #0 at 0x100255178
Crashed Thread: 0
Application Specific Information:
Selector name found in current argument registers: release
Thread 0 Crashed:
0 _______ 0x0000000100255178 _______.PhoneNumberController.viewDidDisappear(Swift.Bool) -> () (PhoneNumberController.swift:97)
1 _______ 0x00000001002551a4 #objc _______.PhoneNumberController.viewDidDisappear(Swift.Bool) -> () (PhoneNumberController.swift:0)
2 UIKit 0x000000018e7026f4 -[UIViewController _setViewAppearState:isAnimating:] + 524
3 UIKit 0x000000018e7765b4 -[UIViewController __viewDidDisappear:] + 140
4 UIKit 0x000000018e7c02e0 -[UINavigationController viewDidDisappear:] + 228
5 UIKit 0x000000018e7026f4 -[UIViewController _setViewAppearState:isAnimating:] + 524
6 UIKit 0x000000018e7765b4 -[UIViewController __viewDidDisappear:] + 140
7 CoreFoundation 0x00000001887ceb10 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
8 CoreFoundation 0x00000001887ce214 _CFXRegistrationPost + 396
9 CoreFoundation 0x00000001887cdf90 ___CFXNotificationPost_block_invoke + 56
10 CoreFoundation 0x000000018883db8c -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1500
11 CoreFoundation 0x000000018870fe64 _CFXNotificationPost + 372
12 Foundation 0x0000000189244e0c -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
13 UIKit 0x000000018e9785d8 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke.2100 + 288
14 UIKit 0x000000018e97bfdc _runAfterCACommitDeferredBlocks + 288
15 UIKit 0x000000018e96dd50 _cleanUpAfterCAFlushAndRunDeferredBlocks + 556
16 UIKit 0x000000018e6dd0b4 _afterCACommitHandler + 164
17 CoreFoundation 0x00000001887e20c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
18 CoreFoundation 0x00000001887dfcf0 __CFRunLoopDoObservers + 368
19 CoreFoundation 0x00000001887e0180 __CFRunLoopRun + 1020
20 CoreFoundation 0x000000018870e2b8 CFRunLoopRunSpecific + 440
21 GraphicsServices 0x000000018a1c2198 GSEventRunModal + 176
22 UIKit 0x000000018e7557fc -[UIApplication _run] + 680
23 UIKit 0x000000018e750534 UIApplicationMain + 204
24 _______ 0x00000001000e3188 main (AppDelegate.swift:25)
25 ??? 0x00000001876f15b8 0x0 + 0

App Store crash report EXC_BREAKPOINT (SIGTRAP)

Below is the crash report downloaded from iTunes Connect, Apple guys says "We were unable to review your app as it crashed on launch".
i know 'EXC_BREAKPOINT (SIGTRAP)' means a non-optional type with a nil value or a failed forced type conversion, i checked the row 0, 1, 2 and 41 concerned about my app's property, new installed, and try updated from old version, all on real device, everything works fine, no crash happens. i've no idea where is the crash kicked?
it's very helpful you can give some me advice. thank you very much!!!
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000101066d5c
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 Cloud 0x0000000101066d5c specialized static ContentViewController.iphone.getter + 388444 (ContentViewController.swift:20)
1 Cloud 0x0000000101049584 specialized PageViewController.init(coder:) + 267652 (PageViewController.swift:16)
2 Cloud 0x000000010104657c #objc PageViewController.init(coder:) + 255356 (PageViewController.swift:0)
3 UIKit 0x000000018acee8bc -[UIClassSwapper initWithCoder:] + 248
4 UIKit 0x000000018ae97588 UINibDecoderDecodeObjectForValue + 688
5 UIKit 0x000000018ae972c0 -[UINibDecoder decodeObjectForKey:] + 104
6 UIKit 0x000000018acee560 -[UIRuntimeConnection initWithCoder:] + 188
7 UIKit 0x000000018ae97588 UINibDecoderDecodeObjectForValue + 688
8 UIKit 0x000000018ae97700 UINibDecoderDecodeObjectForValue + 1064
9 UIKit 0x000000018ae972c0 -[UINibDecoder decodeObjectForKey:] + 104
10 UIKit 0x000000018aced8a0 -[UINib instantiateWithOwner:options:] + 1168
11 UIKit 0x000000018b06a7f0 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196
12 UIKit 0x000000018a9d08dc -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 124
13 UIKit 0x000000018a7d6cdc -[UIApplication _loadMainInterfaceFile] + 264
14 UIKit 0x000000018a9cf5c0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1420
15 UIKit 0x000000018ac5d454 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 800
16 UIKit 0x000000018af2d1f0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
17 UIKit 0x000000018ac5d0b8 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 252
18 UIKit 0x000000018ac5d928 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 748
19 UIKit 0x000000018b3c66e8 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 260
20 UIKit 0x000000018b3c658c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 448
21 UIKit 0x000000018b1429c0 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
22 UIKit 0x000000018b2d7fc8 _performActionsWithDelayForTransitionContext + 112
23 UIKit 0x000000018b142870 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 252
24 UIKit 0x000000018af2c850 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 364
25 UIKit 0x000000018a9cde28 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
26 UIKit 0x000000018add16ec -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364
27 FrontBoardServices 0x00000001839f9768 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364
28 FrontBoardServices 0x0000000183a02070 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224
29 libdispatch.dylib 0x0000000180cdd048 _dispatch_client_callout + 16
30 libdispatch.dylib 0x0000000180ce46c8 _dispatch_block_invoke_direct$VARIANT$mp + 288
31 FrontBoardServices 0x0000000183a2da04 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
32 FrontBoardServices 0x0000000183a2d6a8 -[FBSSerialQueue _performNext] + 404
33 FrontBoardServices 0x0000000183a2dc44 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
34 CoreFoundation 0x0000000181300358 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
35 CoreFoundation 0x00000001813002d8 __CFRunLoopDoSource0 + 88
36 CoreFoundation 0x00000001812ffb60 __CFRunLoopDoSources0 + 204
37 CoreFoundation 0x00000001812fd738 __CFRunLoopRun + 1048
38 CoreFoundation 0x000000018121e2d8 CFRunLoopRunSpecific + 436
39 GraphicsServices 0x00000001830aff84 GSEventRunModal + 100
40 UIKit 0x000000018a7cb880 UIApplicationMain + 208
41 Cloud 0x0000000101010e04 main + 36356 (SearchTableViewController.swift:13)
42 libdyld.dylib 0x0000000180d4256c start + 4
the following is the code for static ContentViewController.iphone.getter:
defined in common.swift:
enum iPhone: CGFloat {
case iPhoneSE = 568
case iPhone = 667
case iPhonePlus = 736
case iPhoneX = 812
init!(_ rawValue: CGFloat) {
self.init(rawValue: rawValue)
}
}
defined in ContentViewController.swift:
static var iphone: iPhone {
let sceneHeight: CGFloat = UIScreen.main.bounds.height
if iPhone(sceneHeight) == .iPhoneSE {
return .iPhoneSE
} else if iPhone(sceneHeight) == .iPhone {
return .iPhone
} else if iPhone(sceneHeight) == .iPhonePlus {
return .iPhonePlus
} else {
return .iPhoneX
}
}
init!(_ rawValue: CGFloat) {
self.init(rawValue: rawValue) }
You use here force unwrapped init but you have cases where enum can return nil if no cases corresponds with the passed value. It can be iPad (768) or iPhone 4s (480). So you are unwrapping nil and system throws an exception.

Initialising MPVolumeView causes app crash on iOS 11 beta 3

Since 3rd beta of iOS 11 my app has started crashing when initialising a MPVolumeView used for AirPlay. The following piece of code is working perfectly fine on earlier versions of iOS and iOS 11 beta 1 and 2.
func setupAirplayButton() {
let rect = CGRect(x: -1000, y: -1000, width: 10, height: 10)
volumeView = MPVolumeView(frame: rect) //app crashes here
volumeView.showsVolumeSlider = false
volumeView.setRouteButtonImage(nil, for: .normal)
volumeView.translatesAutoresizingMaskIntoConstraints = false
volumeView.isHidden = true
if let airplayButton = volumeView.subviews.filter({$0 is UIButton }).first as? UIButton {
self.airplayButton = airplayButton
self.airplayButton?.addObserver(self, forKeyPath: "alpha", options: [.initial, .new], context: nil)
}
NotificationCenter.default.addObserver(self, selector: #selector(wirelessRouteActiveChanged), name: NSNotification.Name.MPVolumeViewWirelessRouteActiveDidChange, object: nil)
myView.addSubview(volumeView)
}
Is anyone else experiencing the same issue?
Edit:
Crash log
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: MyApp [4543]
Triggered by Thread: 0
Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: trying to lock recursively
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000018050b4fc (anonymous namespace)::AutoreleasePoolPage::AutoreleasePoolPage(+ 161020 (anonymous namespace)::AutoreleasePoolPage*) + 28
1 libobjc.A.dylib 0x000000018050b294 (anonymous namespace)::AutoreleasePoolPage::autoreleaseFullPage(objc_object*, + 160404 (anonymous namespace)::AutoreleasePoolPage*) + 60
2 libobjc.A.dylib 0x000000018050b294 (anonymous namespace)::AutoreleasePoolPage::autoreleaseFullPage(objc_object*, + 160404 (anonymous namespace)::AutoreleasePoolPage*) + 60
3 libobjc.A.dylib 0x0000000180508e48 objc_object::rootAutorelease2+ 151112 () + 124
4 CoreUI 0x0000000188a71a48 -[CUICommonAssetStorage renditionInfoForIdentifier:] + 188
5 CoreUI 0x0000000188a7c408 -[CUIStructuredThemeStore _canGetRenditionWithKey:isFPO:lookForSubstitutions:] + 152
6 CoreUI 0x0000000188aa5854 -[CUICatalog _resolvedRenditionKeyFromThemeRef:withBaseKey:scaleFactor:deviceIdiom:deviceSubtype:displayGamut:layoutDirection:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:iconSizeIndex:] + 2112
7 CoreUI 0x0000000188aa5010 -[CUICatalog _resolvedRenditionKeyForName:scaleFactor:deviceIdiom:deviceSubtype:displayGamut:layoutDirection:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:withBaseKeySelector:] + 308
8 CoreUI 0x0000000188aa3d7c -[CUICatalog _namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:displayGamut:layoutDirection:sizeClassHorizontal:sizeClassVertical:] + 176
9 CoreUI 0x0000000188aa406c -[CUICatalog namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:displayGamut:layoutDirection:sizeClassHorizontal:sizeClassVertical:] + 156
10 UIKit 0x000000018b4b4ca0 __139-[_UIAssetManager imageNamed:scale:gamut:layoutDirection:idiom:userInterfaceStyle:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 256
11 UIKit 0x000000018b4b4ae4 -[_UIAssetManager imageNamed:scale:gamut:layoutDirection:idiom:userInterfaceStyle:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 224
12 UIKit 0x000000018b4b5310 -[_UIAssetManager imageNamed:withTrait:] + 576
13 UIKit 0x000000018acbc6cc +[UIImage imageNamed:inBundle:compatibleWithTraitCollection:] + 220
14 UIKit 0x000000018aa7cb74 +[UIImage+ 465780 (UIImagePrivate) imageNamed:inBundle:] + 152
15 MediaPlayer 0x0000000191c36890 -[MPVolumeView _defaultRouteButtonImageAsSelected:] + 120
16 MediaPlayer 0x0000000191c36704 -[MPVolumeView _createSubviews] + 888
17 MediaPlayer 0x0000000191c35288 -[MPVolumeView _initWithStyle:] + 204
18 MediaPlayer 0x0000000191c35370 -[MPVolumeView initWithFrame:style:] + 80
19 MyFramework 0x0000000101b59a84 #nonobjc MPVolumeView.init() + 645764 (ViewController.swift:0)
20 MyFramework 0x0000000101b3a83c MPVolumeView.__allocating_init() + 518204 (ViewController.swift:0)
21 MyFramework 0x0000000101b39b90 ViewController.setupAirplayButton() + 514960 (ViewController.swift:337)
22 MyFramework 0x0000000101b341a4 ViewController.viewDidAppear(_:) + 491940 (ViewController.swift:132)
23 MyFramework 0x0000000101b341f4 #objc ViewController.viewDidAppear(_:) + 492020 (ViewController.swift:0)
24 UIKit 0x000000018aa32e44 -[UIViewController _setViewAppearState:isAnimating:] + 852
25 UIKit 0x000000018aa9c64c __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44
26 UIKit 0x000000018aa9c5e8 -[UIViewController _executeAfterAppearanceBlock] + 92
27 UIKit 0x000000018ac8a368 _runAfterCACommitDeferredBlocks + 556
28 UIKit 0x000000018ac7d8b4 _cleanUpAfterCAFlushAndRunDeferredBlocks + 288
29 UIKit 0x000000018ac95614 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 152
30 CoreFoundation 0x0000000180f85f24 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
31 CoreFoundation 0x0000000180f85718 __CFRunLoopDoBlocks + 288
32 CoreFoundation 0x0000000180f83440 __CFRunLoopRun + 852
33 CoreFoundation 0x0000000180ea5bf0 CFRunLoopRunSpecific + 436
34 GraphicsServices 0x0000000182cfffac GSEventRunModal + 100
35 UIKit 0x000000018aa7dec4 UIApplicationMain + 208
36 MyApp 0x000000010164a558 main + 189784 (AppDelegate.swift:14)
37 libdyld.dylib 0x00000001809ca1e0 start + 4
This appears to be a problem in the simulator. Running on the device causes no issues.
Same here. The funny part: it‘s working on the iPad Pro (12“) but crashing on the iPhone (7 plus).
Tried instantiating with/without frame, by class name, via ObjC at different moments.
When I keep tapping (starting) the app multiple times it actually won’t crash at some point, but the volume view instance is missing in the view hierarchy.
I guess we have to wait for the next beta to fix this issue. :-/
iOS 11 beta 4 fixed the crash issues for my app.
I don‘t see the UISlider itself though.

iOS CAMImagePickerCameraViewController crashes in iOS 10.3.1

My app started to crash after an update to ios 10.3.1 .The crash happens when I attempt to pick a video using the camera. The app works well on older ios versions (9.3.5 and 10.2.1).
The crash log shows that it is the CAMImagePickerCameraViewController that is crashing:
OS Version: iPhone OS 10.3.1 (14E304)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000019
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x1b946f4e realizeClass(objc_class*) + 18
1 libobjc.A.dylib 0x1b94704c realizeClass(objc_class*) + 272
2 libobjc.A.dylib 0x1b94abc6 lookUpImpOrForward + 94
3 libobjc.A.dylib 0x1b94ab64 _class_lookupMethodAndLoadCache3 + 26
4 libobjc.A.dylib 0x1b9511ae _objc_msgSend_uncached + 14
5 CameraUI 0x2f8d6896 -[CAMImagePickerCameraViewController _handleCapturedImagePickerVideoAtPath:withEditingMetadata:] + 166
6 CameraUI 0x2f8d609a -[CAMImagePickerCameraViewController cropOverlayWasOKed:] + 478
7 UIKit 0x2191e804 -[UIApplication sendAction:to:from:forEvent:] + 76
8 UIKit 0x2191e798 -[UIControl sendAction:to:forEvent:] + 62
9 UIKit 0x21908dc8 -[UIControl _sendActionsForEvents:withEvent:] + 478
10 UIKit 0x2191e0d4 -[UIControl touchesEnded:withEvent:] + 604
11 UIKit 0x2191dc1e -[UIWindow _sendTouchesForEvent:] + 2094
12 UIKit 0x21918b5e -[UIWindow sendEvent:] + 2798
13 UIKit 0x218ea702 -[UIApplication sendEvent:] + 308
14 UIKit 0x2207dd36 __dispatchPreprocessedEventFromEventQueue + 2254
15 UIKit 0x220786da __handleEventQueue + 4186
16 UIKit 0x22078abc __handleHIDEventFetcherDrain + 144
17 CoreFoundation 0x1c677fdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
18 CoreFoundation 0x1c677b04 __CFRunLoopDoSources0 + 424
19 CoreFoundation 0x1c675f50 __CFRunLoopRun + 1160
20 CoreFoundation 0x1c5c90ee CFRunLoopRunSpecific + 470
21 CoreFoundation 0x1c5c8f10 CFRunLoopRunInMode + 104
22 GraphicsServices 0x1dd73b40 GSEventRunModal + 80
23 UIKit 0x2194de82 UIApplicationMain + 150
24 Stringr Dev 0x00181604 0x82000 + 1046020
25 libdyld.dylib 0x1bdb64ea start + 2
A similar crash that I see in crashlytics is:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000c839e660
libobjc.A.dylib realizeClass(objc_class*) + 25
libobjc.A.dylib _objc_msgSend_uncached + 14
CameraUI -[CAMImagePickerCameraViewController _handleCapturedImagePickerVideoAtPath:withEditingMetadata:]
CameraUI -[CAMImagePickerCameraViewController cropOverlayWasOKed:]
UIKit UIApplicationMain + 150
Here is an excerpt from my code:
/// Presents the video selection/capture dialog
fileprivate func presentPickerController() {
// Request authorization to access photo library if not yet granted
PHPhotoLibrary.requestAuthorization { status in
guard status == .authorized else {
self.alert(.notPermittedToSelectVideos)
return
}
// Create the custom asset picker (to get multiple at once)
let assetsPickerController = DKImagePickerController()
assetsPickerController.defaultAssetGroup = .smartAlbumVideos
assetsPickerController.showsCancelButton = true
assetsPickerController.assetType = .allVideos
assetsPickerController.didSelectAssets = self.didSelectAssets
assetsPickerController.didCancel = self.didCancel
assetsPickerController.disableCaptureWhenSelected = true
assetsPickerController.createCaptureController = self.createCaptureController
self.assetsPickerController = assetsPickerController
DispatchQueue.main.async {
self.present(assetsPickerController, animated: true) {}
}
}
}
fileprivate func createCaptureController() -> UIViewController? {
let imagePickerController = UIImagePickerController()
imagePickerController.sourceType = .camera
imagePickerController.mediaTypes = [kUTTypeMovie as String]
imagePickerController.videoQuality = .typeHigh
imagePickerController.delegate = self
guard canCaptureVideo() else {
Logger.info?.message("Attempted to capture video when cannot capture video")
alert(.cantCaptureVideo)
return nil
}
guard permittedToCaptureVideo() else {
Logger.info?.message("Attempted to capture video when cannot capture video")
alert(.notPermittedToCaptureVideo)
return nil
}
guard permittedToCaptureAudio() else {
Logger.info?.message("Attempted to capture video when cannot capture audio")
alert(.notPermittedToCaptureAudio)
return nil
}
return imagePickerController
}
The controller that crashes is not part of my application and I cannot touch it. Does anyone have an idea how this problem can be fixed?
What is the purpose of CAMImagePickerCameraViewController? Why does it crash only on ios 10.3.1 and doesn't crash on previous versions?
I have some similar issue here, and i found it's the delegate's problem.
My issue is viewController retain an object, and i set the object's weak delegate to viewController, when viewController dismissed and the object still try to use delegate to do something, crash occurred...
So i think the weak reference goes wrong...no idea why it happens, but you can fix this by add code blow to the viewController dealloc method
- (void)dealloc{
self.assetsPickerController = nil
}

Resources