2016-10-23 12 views
1
// This line crashes in release version (TestFlight) 
// a method called from AFNetworking 3, I added it using CocoaPods. 

let dataTask:NSURLSessionDataTask = 
self.afUrlSessionManager!.dataTaskWithRequest(request) { (response, responseObject, error) in 

     if(error != nil){ 
         loginFailure(error,nil) 

        }else{ 
     // parse responseObject json 
     let loginData:NSMutableDictionary = responseObject as! NSMutableDictionary 
        } 
      } 
dataTask.resume() 

アップルの審査チームによって送信されたクラッシュレポートの次のメソッドを使用するときに私のアプリがリリースバージョンでデバッグバージョンのみクラッシュで正常に動作します:AFNewtworking 3.0

Incident Identifier: D2CE605A-2EC7-4BCE-B8B7-07BC5F93E56D 
CrashReporter Key: d66ba2277da7577ba138220c9e93f0d613cebb50 
Hardware Model:  xxx 
Process:    AfaqyGPS [366] 
Path:    /private/var/containers/Bundle/Application/2A6F7DAC-41A2-42A4-8DE1-4C8100F5F58B/AfaqyGPS.app/AfaqyGPS 

     Identifier:   AF-GP 
     Version:    5.0 (1.0) 
     Code Type:   ARM-64 (Native) 
     Role:    Foreground 
     Parent Process:  launchd [1] 
     Coalition:   AF-GP [447] 


     Date/Time:   2016-10-18 21:29:29.6894 -0700 
     Launch Time:   2016-10-18 21:29:21.1932 -0700 
     OS Version:   iPhone OS 10.0.2 (14A456) 
     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 

     Filtered syslog: 
     None found 

     Thread 0 name: Dispatch queue: com.apple.main-thread 
     Thread 0 Crashed: 
     0 libsystem_kernel.dylib   0x0000000188d96014 0x188d77000 + 126996 
     1 libsystem_pthread.dylib   0x0000000188e5d460 0x188e58000 + 21600 
     2 libsystem_c.dylib    0x0000000188d0a3f4 0x188ca7000 + 406516 
     3 libswiftCore.dylib    0x0000000100980100 swift_deletedMethodError (__hidden#8337_:113) 
     4 libswiftCore.dylib    0x0000000100965bc0 swift::swift_dynamicCastFailure(swift::Metadata const*, swift::Metadata const*, char const*) (__hidden#7547_:409) 
     5 libswiftCore.dylib    0x0000000100965c50 swift_dynamicCastClass (__hidden#7547_:501) 
     6 libswiftCore.dylib    0x000000010098ee04 swift_dynamicCastObjCClassUnconditional (__hidden#9867_:1003) 
     7 AfaqyGPS      0x00000001001518d4 static Services.(login(String, password : String, loginSuccess :() ->(), loginFailure : (NSError?, NSString?) ->()) ->()).(closure #1) (Services.swift:801) 
     8 AFNetworking     0x0000000100661594 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.150 (AFURLSessionManager.m:308) 
     9 libdispatch.dylib    0x0000000188c51200 0x188c50000 + 4608 
     10 libdispatch.dylib    0x0000000188c511c0 0x188c50000 + 4544 
     11 libdispatch.dylib    0x0000000188c55b30 0x188c50000 + 23344 
     12 CoreFoundation     0x0000000189d75f2c 0x189c99000 + 905004 
     13 CoreFoundation     0x0000000189d73b18 0x189c99000 + 895768 
     14 CoreFoundation     0x0000000189ca2048 0x189c99000 + 36936 
     15 GraphicsServices    0x000000018b725198 0x18b719000 + 49560 
     16 UIKit       0x000000018fc75628 0x18fbfa000 + 505384 
     17 UIKit       0x000000018fc70360 0x18fbfa000 + 484192 
     18 AfaqyGPS      0x000000010011c07c main (AppDelegate.swift:14) 
     19 libdyld.dylib     0x0000000188c845b8 0x188c80000 + 17848 

     Thread 1: 
     0 libsystem_pthread.dylib   0x0000000188e58db0 0x188e58000 + 3504 

     Thread 2: 
     0 libsystem_pthread.dylib   0x0000000188e58db0 0x188e58000 + 3504 

     Thread 3 name: com.apple.uikit.eventfetch-thread 
     Thread 3: 
     0 libsystem_kernel.dylib   0x0000000188d7816c 0x188d77000 + 4460 
     1 libsystem_kernel.dylib   0x0000000188d77fdc 0x188d77000 + 4060 
     2 CoreFoundation     0x0000000189d75cec 0x189c99000 + 904428 
     3 CoreFoundation     0x0000000189d73908 0x189c99000 + 895240 
     4 CoreFoundation     0x0000000189ca2048 0x189c99000 + 36936 
     5 Foundation      0x000000018a7b0b1c 0x18a7a4000 + 51996 
     6 Foundation      0x000000018a7d160c 0x18a7a4000 + 185868 
     7 UIKit       0x00000001905eac7c 0x18fbfa000 + 10423420 
     8 Foundation      0x000000018a8ae50c 0x18a7a4000 + 1090828 
     9 libsystem_pthread.dylib   0x0000000188e5b860 0x188e58000 + 14432 
     10 libsystem_pthread.dylib   0x0000000188e5b770 0x188e58000 + 14192 
     11 libsystem_pthread.dylib   0x0000000188e58dbc 0x188e58000 + 3516 

     Thread 4: 
     0 libsystem_kernel.dylib   0x0000000188d96a88 0x188d77000 + 129672 
     1 libsystem_pthread.dylib   0x0000000188e5936c 0x188e58000 + 4972 
     2 libsystem_pthread.dylib   0x0000000188e58db4 0x188e58000 + 3508 

     Thread 5 name: com.apple.NSURLConnectionLoader 
     Thread 5: 
     0 libsystem_kernel.dylib   0x0000000188d7816c 0x188d77000 + 4460 
     1 libsystem_kernel.dylib   0x0000000188d77fdc 0x188d77000 + 4060 
     2 CoreFoundation     0x0000000189d75cec 0x189c99000 + 904428 
     3 CoreFoundation     0x0000000189d73908 0x189c99000 + 895240 
     4 CoreFoundation     0x0000000189ca2048 0x189c99000 + 36936 
     5 CFNetwork      0x000000018a48fcec 0x18a3c3000 + 838892 
     6 Foundation      0x000000018a8ae50c 0x18a7a4000 + 1090828 
     7 libsystem_pthread.dylib   0x0000000188e5b860 0x188e58000 + 14432 
     8 libsystem_pthread.dylib   0x0000000188e5b770 0x188e58000 + 14192 
     9 libsystem_pthread.dylib   0x0000000188e58dbc 0x188e58000 + 3516 

     Thread 6: 
     0 libsystem_pthread.dylib   0x0000000188e58db0 0x188e58000 + 3504 

     Thread 0 crashed with ARM Thread State (64-bit): 
      x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x00000001702c34a6 
      x4: 0x0000000000000014 x5: 0x0000000000000020 x6: 0x0000000000000000 x7: 0x0000000000000cf0 
      x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000000003db5 x11: 0x00000001b0989bcb 
      x12: 0x00000001b0989bcb x13: 0x0000000000000018 x14: 0x0000000000000001 x15: 0x0000000000000881 
      x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006 
      x20: 0x00000001ae3eec40 x21: 0x00000001ae3f40d8 x22: 0x000000016fd02a58 x23: 0x000000016fd02a40 
      x24: 0x000000010013cae8 x25: 0x0000000170472bc0 x26: 0xffffffffffffffff x27: 0x0000000170469bc0 
      x28: 0x000000010013cab4 fp: 0x000000016fd02990 lr: 0x0000000188e5d460 
      sp: 0x000000016fd02970 pc: 0x0000000188d96014 cpsr: 0x00000000 
+0

Services.swiftの801行とは何ですか? – Paulw11

+0

私は質問でそれを言いました。 –

+0

あなたは空の閉鎖をしていますか?何もしていないとデータを取得するのはなぜですか?あなたは強制ダウンキャスト( 'as!')に失敗し、表示されたコードにはコードが含まれていないので、あなたは実際のコードを表示していないと推測します。それを表示してください – Paulw11

答えて

0

は最後に、私は問題を修正し、私は次のメソッドを使用して、URLに追加されたjsonオブジェクトのパラメータをエンコードし、アプリケーションをリリースバージョンでのみクラッシュさせました。私はそれを削除し、代わりにdata.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet());それはうまく動作し、アプリケーションが承認されました。

+(id)getJSONDictObjFromString:(NSString *)jsonString{ 
    NSError * err; 
    if ([jsonString isKindOfClass:[NSDictionary class]]) { 

     return jsonString; 
    } 

    NSData *data =[jsonString dataUsingEncoding:NSUTF8StringEncoding]; 
    NSDictionary * response; 
    if(data!=nil){ 
     response = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err]; 
    } 
    return response; 
}