How to get assembly code from an iOS crashlog - ios

I am dealing with a hard-to-reproduce memory crash, and troubleshooting using the guidance provided in the wwdc18 session 414 with additional clues from this so article
I have no issues symbolicating the stack trace (see at bottom), but when I try to disassemble the address from the last frame, I get this error from the lldb console:
(lldb) disassemble -a 0x00000001052faed4
error: error reading data from section __text
error: Failed to disassemble memory in function at 0x1052faed4.
Memory crashes are difficult, and in this case I really need to additional clues from the assembly code to sort it out.
Sadly the WWDC video flies through the setup/configuration, suggesting it should just work...but it doesn't. I suspect maybe some crucial configuration are missing from the video? Does anyone know how to get to the assembly code?
For reference, this is the top of the symbolicated stack trace (showing the crashing thread)
Thread[0] EXC_BAD_ACCESS (SIGSEGV) (KERN_INVALID_ADDRESS at 0x8000000000000010 -> 0x0000000000000010 (possible pointer authentication failure))
[ 0] 0x00000001052faed4 myApp`Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 60
[ 1] 0x00000001052faecf myApp `Flux.FASFluxDispatcher.invokeCallback(token: Swift.String) -> () + 55
[ 2] 0x00000001052fb2eb myApp `closure #1 () -> () in Flux.FASFluxDispatcher.doDispatch(action: Any) -> () + 195
[ 3] 0x00000001052feeb7 myApp `partial apply forwarder for reabstraction thunk helper from #callee_guaranteed () -> (#error #owned Swift.Error) to #escaping #callee_guaranteed () -> (#out (), #error #owned Swift.Error) + 19
[ 4] 0x00000001bff1ef30 autoreleasepool<A>(invoking:) + 64 (ObjectiveC.swift:172)
[ 5] 0x00000001052fb5af myApp `Flux.FASFluxDispatcher.dispatchAction(action: Any) -> () + 339
[ 6] 0x00000001052ff77f myApp `partial apply forwarder for closure #1 () -> () in Flux.FASActionCreator.dispatchAsync(action: Any, completion: Swift.Optional<() -> ()>) -> () + 111
[ 7] 0x00000001052fc0bf myApp `reabstraction thunk helper from #escaping #callee_guaranteed () -> () to #escaping #callee_unowned #convention(block) () -> () + 19
[ 8] 0x000000019967024c _dispatch_call_block_and_release + 32 (init.c:1454)
[ 9] 0x0000000199671db0 _dispatch_client_callout + 20 (object.m:559)
[ 10] 0x000000019967f7ac _dispatch_main_queue_callback_4CF + 836 (inline_internal.h:2548)
[ 11] 0x00000001999f911c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1790)
[ 12] 0x00000001999f3120 __CFRunLoopRun + 2508 (CFRunLoop.c:3118)
[ 13] 0x00000001999f221c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
[ 14] 0x00000001b15bc784 GSEventRunModal + 164 (GSEvent.c:2259)
[ 15] 0x000000019c432ee8 -[UIApplication _run] + 1072 (UIApplication.m:3253)
[ 16] 0x000000019c43875c UIApplicationMain + 168 (UIApplication.m:4707)
[ 17] 0x0000000104edcf67 myApp `main + 67 at AppDelegate.swift:29:9
[ 18] 0x00000001996b26b0 start + 4
Thread[1]
[ 0] 0x00000001c79cd1ac __psynch_cvwait + 8
[ 1] etc...

The DWARF file in the dSYM only has symbol information & debug information in it, it does not contain a complete copy of the binary's TEXT & DATA segments. If there is a copy of the binary next to the dSYM on the file system lldb will load that when it loads the dSYM. Or you can use the target modules add command to tell lldb to load the binary into the current session.

Related

iOS Crash in UIViewController.presentViewController

I have an intermittent (rarely occurring) crash which, so far has only occurred in the wild with reports from AppStore. With the limited crash log, I have not been able to grok the issue.
I am trying to display an App Store Product page view.
Here is the code
The enclosing class includes the SKStoreProductViewControllerDelegate and
the delegate is set to self.
#objc func adTap(sender: UITapGestureRecognizer? = nil) -> Void {
if adAppID.isEmpty {return}
let paramDict = [SKStoreProductParameterITunesItemIdentifier: adAppID]
storeProductViewController.loadProduct(withParameters: paramDict, completionBlock: { (status: Bool, error: Error?) -> Void in
if status {
self.storeProductViewController.view.frame.origin.y = 0
let eventParams = ["AppID": self.adAppID]
self.present(self.storeProductViewController, animated: true, completion: nil)
}
else {
if let error = error {
print("Error: \(error.localizedDescription)")
}
}})
}
The error is triggered at the self.present:
#8 (null) in thunk for #escaping #callee_guaranteed (#unowned Bool, #guaranteed Error?) -> () ()
#7 0x100b68350 in closure #1 in ViewController.adTap(sender:)
#6 (null) in -[UIViewController presentViewController:animated:completion:] ()
#0 (null) in __exceptionPreprocess ()
Dumping the actual cashpoint file shows a SIGABRT:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x1ad1db278 __exceptionPreprocess + 220 (NSException.m:199)
1 libobjc.A.dylib 0x1acf040a4 objc_exception_throw + 56 (objc-exception.mm:565)
2 UIKitCore 0x1b0bcbe0c -[UIViewController _presentViewController:withAnimationController:completion:] + 4880 (UIViewController.m:7185)
3 UIKitCore 0x1b0bce074 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 104 (UIViewController.m:7671)
4 UIKitCore 0x1b0bce570 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 508 (UIViewController.m:7772)
5 UIKitCore 0x1b0bcdfc4 -[UIViewController _presentViewController:animated:completion:] + 196 (UIViewController.m:7678)
6 UIKitCore 0x1b0bce22c -[UIViewController presentViewController:animated:completion:] + 160 (UIViewController.m:7716)
7 MyAppName 0x100b68350 closure #1 in ViewController.adTap(sender:) + 1016 (ViewController.swift:991)
8 MyAppName 0x100b68580 thunk for #escaping #callee_guaranteed (#unowned Bool, #guaranteed Error?) -> () + 60 (<compiler-generated>:0)
9 StoreKit 0x1bba3c1e8 -[SKStoreProductViewController _loadDidFinishWithResult:error:] + 48 (SKStoreProductViewController.m:425)
10 StoreKit 0x1bba3e624 -[SKRemoteProductViewController loadDidFinishWithResult:error:] + 128 (SKRemoteProductViewController.m:61)
///////
I understand that the completion block is an implicitly escaping block, but I do not see how it does not fulfill the block spec (arguments, if indeed that is the issue). Again, this is an intermittent event. Never seen it on a device tethered to Xcode or on one of our untethered devices. Recently it has occurred in the field, once on a iPhone 7 running iOS 13, and once on a X running 12.3.1
/////
Any thoughts would be appreciated
Let me write this as answer, as I see now that my comment may be unclear. The block
if status {
self.storeProductViewController.view.frame.origin.y = 0
let eventParams = ["AppID": self.adAppID]
self.present(self.storeProductViewController, animated: true, completion: nil)
}
accesses some UI elements, yet it may not be running on main thread (since it's inside callback). So first thing I would suspect is that it's crashing if it happens to be called outside of main thread. Hence I would try this:
if status {
DispatchQueue.main.async {
self.storeProductViewController.view.frame.origin.y = 0
let eventParams = ["AppID": self.adAppID]
self.present(self.storeProductViewController, animated: true, completion: nil)
}
}
If it helps, maybe think of better MVC separation...

com.apple.main-threadEXC_BREAKPOINT, Crash registered on Fabric on Fetching User Facebook Profile in iOS

There is a crash registered on Fabric in my app when I am fetching user's facebook profile information. It is only crashing on release build. I am not able to reproduce the crash even after trying it multiple times. I am fetching the profile in a separate network manager class. I have implemented it using closure and callbacks.
Below is the stack trace and crash report from Fabric.
# OS Version: 11.4.1 (15G77)
# Device: iPhone 6s
# RAM Free: 6%
# Disk Free: 14.3%
#0. Crashed: com.apple.main-thread
0 Roamer 0x104b364a4 LoginViewController.(fetchUserProfile() -> ()).(closure #1) (LoginViewController.swift:250)
1 Roamer 0x104b36d84 partial apply for LoginViewController.(fetchUserProfile() -> ()).(closure #1) (LoginViewController.swift)
2 Roamer 0x104b7ed4c specialized NetworkManager.(fetchFBProfile(((display : Int, status : String, message : String), FBProfileResponse) -> ()) -> ()).(closure #1) (NetworkManager.swift:1234)
3 Roamer 0x104b7e7a4 partial apply for NetworkManager.(fetchFBProfile(((display : Int, status : String, message : String), FBProfileResponse) -> ()) -> ()).(closure #1) (NetworkManager.swift)
4 Roamer 0x104b7e7ec HTTPURLResponse?GraphRequestResult<MyProfileRequest> (NetworkManager.swift)
5 FacebookCore 0x1058dc550 HTTPURLResponse?GraphRequestResult<A> (GraphRequestConnection.swift)
6 FacebookCore 0x1058daaac (HTTPURLResponse?, GraphRequestResult<A>)() (GraphRequestConnection.swift)
7 FacebookCore 0x1058dc8d8 static GraphRequestConnection.sdkRequestCompletion<A where ...> (from : (HTTPURLResponse?, GraphRequestResult<A>) -> ()) -> (FBSDKGraphRequestConnection?, Any?, Error?) -> () empty-list Error first-element-marker HTTPURLResponse (GraphRequestConnection.swift:152)
8 FacebookCore 0x1058dac18 static GraphRequestConnection.sdkRequestCompletion<A where ...> (from : (HTTPURLResponse?, GraphRequestResult<A>) -> ()) -> (FBSDKGraphRequestConnection?, Any?, Error?) -> () empty-list Error first-element-marker HTTPURLResponse (GraphRequestConnection.swift)
9 FacebookCore 0x1058dc5f8 FBSDKGraphRequestConnection?Any?Error? (GraphRequestConnection.swift)
10 FacebookCore 0x1058dc4bc (FBSDKGraphRequestConnection?, Any?, Error?)() (GraphRequestConnection.swift)
11 FacebookCore 0x1058c58bc FBSDKGraphRequestConnection?Any?Error? (AccessToken.swift)
12 FBSDKCoreKit 0x1056a43fc -[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] (FBSDKGraphRequestMetadata.m:48)
13 FBSDKCoreKit 0x1056a1d2c __82-[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:]_block_invoke (FBSDKGraphRequestConnection.m:754)
14 FBSDKCoreKit 0x1056a1b88 -[FBSDKGraphRequestConnection processResultBody:error:metadata:canNotifyDelegate:] (FBSDKGraphRequestConnection.m:818)
15 FBSDKCoreKit 0x1056a163c __64-[FBSDKGraphRequestConnection completeWithResults:networkError:]_block_invoke (FBSDKGraphRequestConnection.m:738)
16 CoreFoundation 0x1825a0a20 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 216
17 FBSDKCoreKit 0x1056a13e0 -[FBSDKGraphRequestConnection completeWithResults:networkError:] (FBSDKGraphRequestConnection.m:717)
18 FBSDKCoreKit 0x1056a087c -[FBSDKGraphRequestConnection completeFBSDKURLSessionWithResponse:data:networkError:] (FBSDKGraphRequestConnection.m:582)
19 FBSDKCoreKit 0x10569ea54 __36-[FBSDKGraphRequestConnection start]_block_invoke_2 (FBSDKGraphRequestConnection.m:222)
20 libdispatch.dylib 0x181fb8aa0 _dispatch_call_block_and_release + 24
21 libdispatch.dylib 0x181fb8a60 _dispatch_client_callout + 16
22 libdispatch.dylib 0x181fc565c _dispatch_main_queue_callback_4CF$VARIANT$mp + 1012
23 CoreFoundation 0x18266f070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
24 CoreFoundation 0x18266cbc8 __CFRunLoopRun + 2272
25 CoreFoundation 0x18258cda8 CFRunLoopRunSpecific + 552
26 GraphicsServices 0x184572020 GSEventRunModal + 100
27 UIKit 0x18c5ac758 UIApplicationMain + 236
28 Roamer 0x104b1fbf8 main (DetailsCell.swift:28)
29 libdyld.dylib 0x18201dfc0 start + 4
--
Below is the function in LoginViewController from where I am calling the fetchFBProfile function in NetworkManager:
func fetchUserProfile()
{
NetworkManager.sharedInstance.fetchFBProfile() { [unowned self] (responseStatus: ResponseStatus, responseObj: FBProfileResponse) in
if responseStatus.status == "Success"
{
self.fbSignIn(responseObj)
}
else{
if responseStatus.display == 1
{
self.showBanner(Strings.failureHeaderMsg, responseStatus.message, true, true)
}
else{
self.showBanner(Strings.failureHeaderMsg, Strings.serverErrorMsg, true, true)
}
}
}
}
Below is the fetchFBProfile function in NetworkManager:
func fetchFBProfile( _ completion: #escaping GenericResponseWithObj<FBProfileResponse>) -> Void {
let connection = GraphRequestConnection()
progress.show(style: ProgressStyle())
connection.add(MyProfileRequest()) { response, result in
switch result {
case .success(let response):
let fBProfileResponse = FBProfileResponse()
fBProfileResponse.birthday = response.birthday
fBProfileResponse.email = response.email
fBProfileResponse.gender = response.gender
fBProfileResponse.id = response.id
fBProfileResponse.locale = response.locale
fBProfileResponse.name = response.name
fBProfileResponse.profilePictureUrl = response.profilePictureUrl
completion((0, "Success", "Facebook SignIn Successful"), fBProfileResponse)
case .failed(let error):
print("Custom Graph Request Failed: \(error)")
self.progress.dismiss()
completion((0, "Failure", "Couldn't fetch user response"), FBProfileResponse())
}
}
connection.start()
}
I can't understand the crash report from fabric and also the app is working flawlessly on my end. Any help would be deeply appreciated. Thanks

iOS Today Extension Crashing

We've added Today Extension to our app recently.
Its an extension with simple tableView to load data from our server, written in Swift.
But after the extension is online to our users, we've received lots of crash data from Crashlytics and also Apple is reporting same crash issue either.
However, we can't reproduce the crash, or even find the reason of crash, because is crashing on the widgetPerformUpdateWithCompletionHandler method which is called by the system.
Below is the detail of crash log, some information are replaced.
Crashed: com.apple.main-thread
0 MyAppWidget 0x100091d8c MyAppWidgetViewController.(widgetPerformUpdateWithCompletionHandler((NCUpdateResult) -> ()) -> ()).(closure #1) (MyAppWidgetViewController.swift)
1 MyAppKit 0x100603ab4 partial apply for thunk (PostService.swift)
2 MyAppKit 0x100626080 ServiceRequestPerfomer.(performRequest(A, complete : ([B]?, NSError?) -> ()?) -> ()).(closure #1) (ServiceRequestPerformer.swift:35)
3 MyAppKit 0x1006258d4 partial apply for ServiceRequestPerfomer.(performRequest(A, complete : ([B]?, NSError?) -> ()?) -> ()).(closure #1) (ServiceRequestPerformer.swift)
4 MyAppKit 0x100626b34 ServiceRequestPerfomer.((request in _3C50B415180DDC893FFCB75CD7EE7019)(A, complete : (response : Response?, error : NSError?) -> ()?) -> ()).(closure #1) (ServiceRequestPerformer.swift:144)
5 Moya 0x1004b7468 MoyaProvider.(requestNormal(A, queue : OS_dispatch_queue?, progress : (progress : ProgressResponse) -> ()?, completion : (result : Result<Response, Error>) -> ()) -> Cancellable).(closure #1).(closure #1) (Moya.swift:229)
6 Moya 0x1004b8968 MoyaProvider.((sendAlamofireRequest in _1A5616FEE5C423A992964CB19AABD52B)(Request, target : A, queue : OS_dispatch_queue?, progress : (progress : ProgressResponse) -> ()?, completion : (result : Result<Response, Error>) -> ()) -> CancellableToken).(closure #3) (Moya.swift)
7 Moya 0x1004b57b8 partial apply for MoyaProvider.((sendAlamofireRequest in _1A5616FEE5C423A992964CB19AABD52B)(Request, target : A, queue : OS_dispatch_queue?, progress : (progress : ProgressResponse) -> ()?, completion : (result : Result<Response, Error>) -> ()) -> CancellableToken).(closure #3) (Moya.swift)
8 Alamofire 0x1002cff64 Request.(response(queue : OS_dispatch_queue?, completionHandler : (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> ()) -> Self).(closure #1).(closure #1) (ResponseSerialization.swift)
9 libdispatch.dylib 0x1819e14bc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x1819e147c _dispatch_client_callout + 16
11 libdispatch.dylib 0x1819e6b84 _dispatch_main_queue_callback_4CF + 1844
12 CoreFoundation 0x181f4cd50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13 CoreFoundation 0x181f4abb8 __CFRunLoopRun + 1628
14 CoreFoundation 0x181e74c50 CFRunLoopRunSpecific + 384
15 GraphicsServices 0x18375c088 GSEventRunModal + 180
16 UIKit 0x18715e088 UIApplicationMain + 204
17 libxpc.dylib 0x181c38ce0 _xpc_objc_main + 784
18 libxpc.dylib 0x181c3a9dc xpc_main + 200
19 Foundation 0x182a57d60 service_connection_handler + 170
20 PlugInKit 0x18929ac48 -[PKService run] + 544
21 PlugInKit 0x18929a8dc +[PKService main] + 56
22 PlugInKit 0x18929ac6c +[PKService _defaultRun:arguments:] + 20
23 libextension.dylib 0x18286a058 NSExtensionMain + 64
24 libdispatch.dylib 0x181a128b8 (Missing)
And the code of widgetPerformUpdateWithCompletionHandler
func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)) {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResult.Failed
// If there's no update required, use NCUpdateResult.NoData
// If there's an update, use NCUpdateResult.NewData
let options: [String: AnyObject] = [DCKPostPopularAttributeName : true.stringValue,
DCKPaginationLimitAttributeName : 5]
postService.posts(options: options) { (posts, error) in
let historyPosts = self.userDefaults.arrayForKey(MyAppWidgetViewController.WidgetPostReadIdentifier) as? [UInt]
if let historyPosts = historyPosts {
self.posts = posts!.filter({ (Post) -> Bool in
return !historyPosts.contains(Post.id)
})
} else {
self.posts = posts!
}
self.tableView.reloadData()
self.tableView.hidden = false;
self.loadingLabel?.hidden = true
self.activityIndicator?.stopAnimating()
let contentSize = self.tableView.contentSize
self.preferredContentSize = CGSizeMake(CGRectGetWidth(self.view.frame), contentSize.height);
self.loadMorePostsIfNeeded()
}
completionHandler(NCUpdateResult.NewData)
}
The strange thing is:
We haven't encountered the crash issue while we're using our Today Extension normally (It should show Unable to load if today extension crashes)
We didn't receive any issue from our users reporting that today extension isn't working.
We've found the same crash log on our device, but the today extension is working normally as 1. described. And also, the time of crash log recorded, I'm not using my phone!
So we're guessing it's a 「fake」crash, the crash is logged, but the extension didn't really crashed.
Does anybody facing the same issue?
Thank you!
Answering my own question,
#matt is right, Now I am calling the completionHandler only when data fetch task completes, instead of always call the completionHandler at the last of widgetPerformUpdateWithCompletionHandler method.
I didn't receive crashes anymore, the problem was solved!

ReactiveCocoa Swift crash

I have a weird crash in Hockeyapp for my application
Thread 0 Crashed:
0 Tricount 0x00000001001f51d8 View.BalancesInteractor.balancesInfo.getter : View.BalanceInfoModel (BalancesInteractor.swift:22)
1 Tricount 0x00000001001fd1fc View.BalancesInteractor.(init (tricountManager : View.TricountManager) -> View.BalancesInteractor).(closure #1) (BalancesInteractor.swift:45)
2 Tricount 0x00000001000d4818 reabstraction thunk helper from #callee_owned (#owned Model.Tricount) -> (#unowned ()) to #callee_owned (#in Model.Tricount) -> (#unowned ()) (TransactionsInteractor.swift:0)
3 ReactiveCocoa 0x00000001013ccb94 ReactiveCocoa.Observer.(init (failed : (B) -> ()?, completed : () -> ()?, interrupted : () -> ()?, next : (A) -> ()?) -> ReactiveCocoa.Observer<A, B>).(closure #1) (Observer.swift:24)
4 ReactiveCocoa 0x00000001013cc644 partial apply forwarder for ReactiveCocoa.Observer.(init (failed : (B) -> ()?, completed : () -> ()?, interrupted : () -> ()?, next : (A) -> ()?) -> ReactiveCocoa.Observer<A, B>).(closure #1) (Observer.swift:0)
5 ReactiveCocoa 0x00000001013e66a8 ReactiveCocoa.Signal.(init ((ReactiveCocoa.Observer<A, B>) -> ReactiveCocoa.Disposable?) -> ReactiveCocoa.Signal<A, B>).(closure #1) (Signal.swift:63)
6 ReactiveCocoa 0x0000000101405a88 ReactiveCocoa.SignalProducer.(startWithSignal ((ReactiveCocoa.Signal<A, B>, ReactiveCocoa.Disposable) -> ()) -> ()).(closure #2) (SignalProducer.swift:252)
7 ReactiveCocoa 0x00000001013e66a8 ReactiveCocoa.Signal.(init ((ReactiveCocoa.Observer<A, B>) -> ReactiveCocoa.Disposable?) -> ReactiveCocoa.Signal<A, B>).(closure #1) (Signal.swift:63)
8 ReactiveCocoa 0x00000001013e954c (extension in ReactiveCocoa):ReactiveCocoa.SignalType.(delay (Swift.Double, onScheduler : ReactiveCocoa.DateSchedulerType) -> ReactiveCocoa.Signal<A.Value, A.Error>).(closure #1).(closure #1).(closure #2) (Signal.swift:423)
9 ReactiveCocoa 0x00000001013d5720 ReactiveCocoa.UIScheduler.(schedule (() -> ()) -> ReactiveCocoa.Disposable?).(closure #1) + 56
10 libdispatch.dylib 0x00000001812014bc _dispatch_call_block_and_release + 20
11 libdispatch.dylib 0x000000018120147c _dispatch_client_callout + 12
12 libdispatch.dylib 0x0000000181206b84 _dispatch_main_queue_callback_4CF + 1840
13 CoreFoundation 0x000000018176cd50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
14 CoreFoundation 0x000000018176abb8 __CFRunLoopRun + 1624
15 CoreFoundation 0x0000000181694c50 CFRunLoopRunSpecific + 380
16 GraphicsServices 0x0000000182f7c088 GSEventRunModal + 176
17 UIKit 0x000000018697e088 UIApplicationMain + 200
18 Tricount 0x000000010015674c main (AppDelegate.swift:12)
19 ??? 0x00000001812328b8 0x0 + 0
I haven't be able to reproduce it.
Also the crash happen on a getter, isn't it weird ? Or I think I miss something... I don't know were to look exactly
If you need more info, juste tell me.
If you have any clue, don't hesitate.
Thanks you for your help.
EDIT 1:
This is the signal producer that used balancesInfo:
self.tricountManager
.updatedTricountSignalProducer
.observeOn(UIScheduler())
.startWithNext { [unowned self] _ in
self.presenter.updateView(self.balancesInfo) //LIGNE 45
}
Those lignes of code are in the balancesInteractor init's.
EDIT 2:
Here is the ligne of code for creating the balanceInfo.
var balancesInfo: BalanceInfoModel {
let balances = self.calculateBalances()
self.solutions = self.calculateSolutions(balances)
self.tricountManager.solutionCount = solutions.count
return BalanceInfoModel(
isBalanced: self.solutions.isEmpty,
balances: balances,
solutions: self.solutions.map(self.convert)
)
}

How to read this ios symbolicated crash log?

Apple rejected an APP's new version and sent me back crash log, it's hard for me to find the problem even the crash log has been symbolicated in Xcode. From the following, I guess that something wrong in func getGameCenterScore at line 246? Does it tell more problems?
BTW, before calling the func GameCenterScore(), GKLocalPlayer.localPlayer().authenticated is checked, but network is not checked. I have to think it problem here. Any suggestion?
Thx.
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000100054ef4
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 xoxo 0x0000000100054ef4 xoxo.ViewController.(getGameCenterScore (xoxo.ViewController) -> () -> Swift.Int).(closure #1) (ViewController.swift:246)
1 xoxo 0x00000001000546b0 partial apply forwarder for reabstraction thunk helper from #callee_owned (#in ([Swift.AnyObject]!, ObjectiveC.NSError!)) -> (#out ()) to #callee_owned (#owned [Swift.AnyObject]!, #owned ObjectiveC.NSError!) -> (#unowned ()) with unmangled suffix "315" (ViewController.swift:0)
2 xoxo 0x0000000100055110 reabstraction thunk helper from #callee_owned (#owned [Swift.AnyObject]!, #owned ObjectiveC.NSError!) -> (#unowned ()) to #callee_unowned #objc_block (#unowned ObjectiveC.NSArray!, #unowned ObjectiveC.NSError!) -> (#unowned ()) (ViewController.swift:0)
3 GameCenterFoundation 0x000000018e9de3a0 0x18e964000 + 500640
4 libdispatch.dylib 0x0000000197841990 0x197840000 + 6544
5 libdispatch.dylib 0x0000000197841950 0x197840000 + 6480
6 libdispatch.dylib 0x0000000197846208 0x197840000 + 25096
7 CoreFoundation 0x0000000185a877f4 0x1859a8000 + 915444
8 CoreFoundation 0x0000000185a8589c 0x1859a8000 + 907420
9 CoreFoundation 0x00000001859b12d0 0x1859a8000 + 37584
10 GraphicsServices 0x000000018f09f6f8 0x18f094000 + 46840
11 UIKit 0x000000018a576fa8 0x18a500000 + 487336
12 xoxo 0x00000001000636c0 main (AppDelegate.swift:12)
13 libdyld.dylib 0x000000019786ea04 0x19786c000 + 10756
func getGameCenterScore(){
var gameCenterScore = 0
let leaderBoardRequest = GKLeaderboard()
leaderBoardRequest.identifier = "XXXXXXXXXXXXX"
leaderBoardRequest.loadScoresWithCompletionHandler { (scores, error) -> Void in
if (error != nil) {
println("Error: \(error!.localizedDescription)")
} else if (scores != nil) {
let localPlayerScore = leaderBoardRequest.localPlayerScore
gameCenterScore = Int(localPlayerScore.value)
if self.saveData.stringForKey("topScore") == nil {
self.saveData.setValue(gameCenterScore, forKey: "topScore")
self.topScoreLabel.text = "\(gameCenterScore)"
}else{
if gameCenterScore > self.saveData.integerForKey("topScore"){
self.saveData.setValue(gameCenterScore, forKey: "topScore")
self.topScoreLabel.text = "\(gameCenterScore)" // line 246
}
}
}
}
}
Just went through he same thing. A binary rejection for my uploaded app. Finally, got it accepted. I found the line number much like you did. (I used textWrangler and compared the symbolicated text to the original crash. And there was only one line that it could have been. Much like your 216.)
Lines listed as swift:0 are after the crash causing line.
To Solve or eradicate the problem:
1) I found ghosts can linger in my swift code. Clean and rebuild. Try moving the code around.
2) Note that the line where the crash is listed as being may be off by a few lines. The line they listed for my app was a comment. The error was the code above and that code looked okay. I solved it by rewriting in a different way.
3) Look over your code very carefully.
if gameCenterScore > self.saveData.integerForKey("topScore"){`enter code here`
Would this crash if your gameCenterScore == topScore?

Resources