当我获取用户的Facebook个人资料信息时,我的应用程序中的Fabric上注册了崩溃。它仅在发布版本时崩溃。即使多次尝试,我也无法重现崩溃。我正在单独的网络管理器类中获取配置文件。我已经使用闭包和回调实现了它。
下面是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
--
下面是LoginViewController中的函数,我在其中从NetworkManager中调用fetchFBProfile函数:
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)
}
}
}
}
下面是NetworkManager中的fetchFBProfile函数:
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()
}
我无法从Fabric上了解崩溃报告,而且该应用程序在我的视线中也可以正常使用。任何帮助将不胜感激。谢谢