com.apple.main-threadEXC_BREAKPOINT, Crash registered on Fabric on Fetching User Facebook Profile in iOS - 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

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...

iOS app rejected by Apple due to IPV6 issue but crash report indicates assertion failed

My iOS app does not use any networking and works fine on my iPhone, but Apple rejected it supposedly due to IPv6 incompatibility issues.
2. 1 PERFORMANCE: APP COMPLETENESS
Performance - 2.1
Your app crashes on iPhone running iOS 10.0.3 connected to an IPv6 network when we:
Specifically, we found your app crashes when we tap “Analyze.”
We have attached detailed crash logs to help troubleshoot this issue.
However when I symbolicated the crash report they sent, it shows a particular thread crashed. The backtrace is below.
Thread 5 name: Dispatch queue: com.apple.HealthKit.HKHealthStore.client.0x1700f6d00
Thread 5 Crashed:
0 libswiftCore.dylib 0x0000000100273ae8 _assertionFailed(StaticString, String, StaticString, UInt, flags : UInt32) -> Never (__hidden#14874_:167)
1 libswiftCore.dylib 0x0000000100273ae8 _assertionFailed(StaticString, String, StaticString, UInt, flags : UInt32) -> Never (__hidden#14874_:167)
2 PickerTest 0x00000001000c1d1c type metadata accessor for String? (PyschicBrain.swift:0)
3 PickerTest 0x00000001000bfe78 PsychicBrain.(isHeartRateInfoAvailableForDates() -> Bool).(closure #1) (PyschicBrain.swift:0)
4 libdispatch.dylib 0x000000018f98d200 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x000000018f98d1c0 _dispatch_client_callout + 16
6 libdispatch.dylib 0x000000018f99b444 _dispatch_queue_serial_drain + 928
7 libdispatch.dylib 0x000000018f9909a8 _dispatch_queue_invoke + 652
8 libdispatch.dylib 0x000000018f99b940 _dispatch_queue_override_invoke + 360
9 libdispatch.dylib 0x000000018f99d38c _dispatch_root_queue_drain + 572
10 libdispatch.dylib 0x000000018f99d0ec _dispatch_worker_thread3 + 124
11 libsystem_pthread.dylib 0x000000018fb952c8 _pthread_wqthread + 1288
12 libsystem_pthread.dylib 0x000000018fb94db4 start_wqthread + 4
Stack frame #3 (above) says the closure in the function isHeartRateInfoAvailableForDates() failed, which means the HKSampleQuery failed.
My question: I'm assuming this is because no heart-rate data was found for that interval. On my phone, in this scenario, samples.count() returns 0 and hence the function returns FALSE. When Apple folks test it, obviously they get a different error. I've asked Apple for console logs but I would like to know a more elegant way of error handling.
func isHeartRateInfoAvailableForDates() -> Bool {
predicate = HKQuery.predicateForSamples(withStart: pvtStartDate, end: pvtEndDate, options: HKQueryOptions())
guard let sampleType = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate) else {
fatalError("HKSampleType.quantityTypeForIdentifier failed")
}
let dispatchGrp = DispatchGroup()
// Entering query block
//
dispatchGrp.enter()
let query = HKSampleQuery(sampleType: sampleType, predicate: predicate, limit: Int(HKObjectQueryNoLimit), sortDescriptors: nil) {
query, results, error in
guard let samples = results as? [HKQuantitySample] else {
fatalError("An error occured fetching the user's heart rate: \(error?.localizedDescription)");
}
self.pvtSampleCount = samples.count
// leave group once query results are available
dispatchGrp.leave()
}
pvtHealthStore.execute(query)
// Now wait for the query to complete
//
dispatchGrp.wait(timeout: DispatchTime.distantFuture)
return pvtSampleCount > 0
}

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