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
}
Related
According to appstore review my app crashes on a specific point. How ever i have tried it on a real device as well as all simulators and works completely fine with me. I was sent a crash log and have symbolicated it. Following is the out come :
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000104dc8750 ChatInnerVC.checkIfCurrentUserBlocked() (in Blatini) (ChatInnerVC.swift:523)
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [6106]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 Blatini 0x0000000104dc8750 ChatInnerVC.checkIfCurrentUserBlocked() (in Blatini) (ChatInnerVC.swift:523)
1 Blatini 0x0000000104dc3aec ChatInnerVC.viewDidLoad() (in Blatini) (ChatInnerVC.swift:63)
2 Blatini 0x0000000104dc3c48 #objc ChatInnerVC.viewDidLoad() (in Blatini) (<compiler-generated>:0)
3 UIKitCore 0x00000001a44eb748 0x1a40ef000 + 4179784
4 UIKitCore 0x00000001a44f02fc 0x1a40ef000 + 4199164
5 UIKitCore 0x00000001a44f06e8 0x1a40ef000 + 4200168
6 UIKitCore 0x00000001a444c3a8 0x1a40ef000 + 3527592
7 UIKitCore 0x00000001a446087c 0x1a40ef000 + 3610748
8 UIKitCore 0x00000001a4461c1c 0x1a40ef000 + 3615772
9 UIKitCore 0x00000001a4444900 0x1a40ef000 + 3496192
10 UIKitCore 0x00000001a502f2bc 0x1a40ef000 + 15991484
11 QuartzCore 0x00000001a7680978 0x1a7529000 + 1407352
12 QuartzCore 0x00000001a7680db8 0x1a7529000 + 1408440
13 QuartzCore 0x00000001a769321c 0x1a7529000 + 1483292
14 QuartzCore 0x00000001a75d7e10 0x1a7529000 + 716304
15 QuartzCore 0x00000001a76028c4 0x1a7529000 + 891076
16 QuartzCore 0x00000001a76034b4 0x1a7529000 + 894132
17 CoreFoundation 0x00000001a09b011c 0x1a0904000 + 704796
18 CoreFoundation 0x00000001a09aae4c 0x1a0904000 + 683596
19 CoreFoundation 0x00000001a09ab2dc 0x1a0904000 + 684764
20 CoreFoundation 0x00000001a09aabc8 0x1a0904000 + 682952
21 GraphicsServices 0x00000001aad8c5cc 0x1aad89000 + 13772
22 UIKitCore 0x00000001a4b5d744 0x1a40ef000 + 10938180
23 Blatini 0x0000000104d24950 main (in Blatini) (AppDelegate.swift:23)
24 libdyld.dylib 0x00000001a0827384 0x1a0826000 + 4996
Following is the function on line 523 :
// MARK: Check if current user is blocked i.e your self
func checkIfCurrentUserBlocked(){
if clientID.isEmpty {
self.clientID = self.chatModObj.from_user_id!
}
//line 523
apiManager.checkIfCurrentUserIsBlocked(self.clientID as! String, user_to: self.resid as! String, success: { (result) in
if result == true {
self.whenIAmBlocked()
}else{
print("You are not blocked")
}
}) { (error) in
print("You are not Blocked")
}
Following is the function in call on line 63 under viewdidload :
//line 63
if self.clientName!.isEmpty{
print("---->", self.chatModObj.from_username)
self.clientName = self.chatModObj.from_username
}
I am unable to track the cause of crash since it works really fine with me and from where the app store is complaining crash line 63 self.clientName is never empty.
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
Hello I have been seeing crash logs for my app which when I open in XCode highlights the following line
let appDelegate = UIApplication.shared.delegate as! AppDelegate
I am stumped as I cannot replicate this in XCode. What are the possible reasons the app may crash here?
This line is at viewDidAppear() and also at viewDidLoad() but 5 out of 5 crash reports all point to the line at viewDidAppear()
Edit:
Here's the crash log
Thread 0 name:
Thread 0 Crashed:
0 MyApp 0x0000000100531208 LoginViewController.initView() + 536 (LoginViewController.swift:107)
1 MyApp 0x0000000100530d88 #objc LoginViewController.viewDidAppear(_:) + 112 (LoginViewController.swift:58)
2 UIKit 0x000000018ee2973c -[UIViewController _setViewAppearState:isAnimating:] + 840 (UIViewController.m:4471)
3 UIKit 0x000000018f07a448 __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44 (UIViewController.m:5055)
4 UIKit 0x000000018ee7f798 -[UIViewController _executeAfterAppearanceBlock] + 92 (UIViewController.m:4793)
5 UIKit 0x000000018f185990 _runAfterCACommitDeferredBlocks + 564 (UIApplication.m:2528)
6 UIKit 0x000000018f17b958 _cleanUpAfterCAFlushAndRunDeferredBlocks + 384 (UIApplication.m:2497)
7 UIKit 0x000000018f18c68c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 152 (UIApplication.m:9928)
8 CoreFoundation 0x00000001851372bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20 (CFRunLoop.c:1840)
9 CoreFoundation 0x0000000185136a7c __CFRunLoopDoBlocks + 264 (CFRunLoop.c:1881)
10 CoreFoundation 0x00000001851347b0 __CFRunLoopRun + 1224 (CFRunLoop.c:2922)
11 CoreFoundation 0x0000000185054da8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
12 GraphicsServices 0x000000018703a020 GSEventRunModal + 100 (GSEvent.c:2245)
13 UIKit 0x000000018f074758 UIApplicationMain + 236 (UIApplication.m:3965)
14 MyApp 0x0000000100424f3c main + 56 (BaseViewController.swift:19)
15 libdyld.dylib 0x0000000184ae5fc0 start + 4
I found this delegate is optional value.
unowned(unsafe) open var delegate: UIApplicationDelegate?
So you should use it like this.
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
// code here
} else {
// error handle
}
I finally figured this out. The crash logs all point to this line
let appDelegate = UIApplication.shared.delegate as! AppDelegate
which is line 107 from my LoginViewController but the actual error is actually triggered by a line of code two lines prior (data related error). Don't know why the logs all point to line 107 though. Thanks for your help.
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
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.