简体   繁体   English

Alamofire仅在运行存档的应用程序时崩溃

[英]Alamofire crashes only when running archived app

I am having an issue with my HTTP request using Alamofire. 使用Alamofire的HTTP请求出现问题。 When I try to reproduce the issue with the XCode debugger it does not crashes but when I archive the app and run the .ipa file on my iPad with ios 10.0.2 I always get a crash. 当我尝试使用XCode调试器重现该问题时,它不会崩溃,但是当我存档该应用程序并使用ios 10.0.2在iPad上运行.ipa文件时,我总是会崩溃。

This is an example of a call that crashes when running the arhived app: 这是一个调用示例,该调用在运行存档的应用程序时崩溃:

static func loginOnServerUrl(serverURL: String, user: String, password: String,
        successCallback: ((JSON) -> Void)? = nil, failureCallback: ((Error) -> Void)? = nil){

            let params = [
                ApiParams.ACTION : "login",
                ApiParams.LoginParams.USER : user,
                ApiParams.LoginParams.PASSWORD : password,
            ]

        Alamofire.request("http://\(serverURL)/AppSrv", method: .get, parameters: params).responseJSON { response in
                switch response.result {
                case .success(let value):
                    //JSON raiz
                    let json = JSON(value)

                    for (key, value) in json.acceptingSigleValueAsArray {
                        log("\(key) : \(value)")
                    }


                     if let successCallback = successCallback {
                         successCallback(json)
                     }


                case .failure(let error):
                    log(error.localizedDescription)
                    if let failureCallback = failureCallback {
                        failureCallback(error)
                    }
                }
            }
    }

This is one of the crash logs I am getting: 这是我收到的崩溃日志之一:

Incident Identifier: ****
CrashReporter Key:   *****
Hardware Model:      iPad5,2
Process:             ****
Path:                ****
Identifier:         ****
Version:             1.42 (1.2.3a)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           ****


Date/Time:           2016-10-21 10:16:08.9811 +0200
Launch Time:         2016-10-21 10:16:06.2504 +0200
OS Version:          iPhone OS 10.0.2 (14A456)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000059480bec8
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   libswiftCore.dylib              0x0000000100e19b6c 0x100c38000 + 1973100
1   myapp                           0x00000001000c4d88 static ServerManager.(pingOnServerUrl(serverUrl : String, successCallback : (Int64) -> ()?, failureCallback : (Error) -> ()?) -> ()).(closure #1) (ServerManager.swift:0)
2   Alamofire                       0x00000001003aca84 specialized DataRequest.(response<A where ...> (queue : DispatchQueue?, responseSerializer : A, completionHandler : (DataResponse<A.SerializedObject>) -> ()) -> Self).(closure #1).(closure #1) (ResponseSerialization.swift:0)
3   libdispatch.dylib               0x00000001889f1200 _dispatch_call_block_and_release + 24
4   libdispatch.dylib               0x00000001889f11c0 _dispatch_client_callout + 16
5   libdispatch.dylib               0x00000001889f5d6c _dispatch_main_queue_callback_4CF + 1000
6   CoreFoundation                  0x0000000189b15f2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
7   CoreFoundation                  0x0000000189b13b18 __CFRunLoopRun + 1660
8   CoreFoundation                  0x0000000189a42048 CFRunLoopRunSpecific + 444
9   GraphicsServices                0x000000018b4c5198 GSEventRunModal + 180
10  UIKit                           0x000000018fa15628 -[UIApplication _run] + 684
11  UIKit                           0x000000018fa10360 UIApplicationMain + 208
12  myapp                           0x00000001000bf024 main (AppDelegate.swift:16)
13  libdyld.dylib                   0x0000000188a245b8 start + 4

Thread 1:
0   libsystem_kernel.dylib          0x0000000188b36a88 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000188bf936c _pthread_wqthread + 1452
2   libsystem_pthread.dylib         0x0000000188bf8db4 start_wqthread + 4

Thread 2:
0   libsystem_kernel.dylib          0x0000000188b36a88 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000188bf936c _pthread_wqthread + 1452
2   libsystem_pthread.dylib         0x0000000188bf8db4 start_wqthread + 4

Thread 3:
0   libsystem_pthread.dylib         0x0000000188bf8db0 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib         0x0000000188bf8db0 start_wqthread + 0

Thread 5:
0   libsystem_kernel.dylib          0x0000000188b36a88 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000188bf936c _pthread_wqthread + 1452
2   libsystem_pthread.dylib         0x0000000188bf8db4 start_wqthread + 4

Thread 6 name:  com.apple.uikit.eventfetch-thread
Thread 6:
0   libsystem_kernel.dylib          0x0000000188b1816c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000188b17fdc mach_msg + 72
2   CoreFoundation                  0x0000000189b15cec __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x0000000189b13908 __CFRunLoopRun + 1132
4   CoreFoundation                  0x0000000189a42048 CFRunLoopRunSpecific + 444
5   Foundation                      0x000000018a550b1c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x000000018a57160c -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7   UIKit                           0x000000019038ac7c -[UIEventFetcher threadMain] + 136
8   Foundation                      0x000000018a64e50c __NSThread__start__ + 1024
9   libsystem_pthread.dylib         0x0000000188bfb860 _pthread_body + 240
10  libsystem_pthread.dylib         0x0000000188bfb770 _pthread_body + 0
11  libsystem_pthread.dylib         0x0000000188bf8dbc thread_start + 4

Thread 7 name:  com.apple.NSURLConnectionLoader
Thread 7:
0   libsystem_kernel.dylib          0x0000000188b1816c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000188b17fdc mach_msg + 72
2   CoreFoundation                  0x0000000189b15cec __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x0000000189b13908 __CFRunLoopRun + 1132
4   CoreFoundation                  0x0000000189a42048 CFRunLoopRunSpecific + 444
5   CFNetwork                       0x000000018a22fcec +[NSURLConnection(Loader) _resourceLoadLoop:] + 336
6   Foundation                      0x000000018a64e50c __NSThread__start__ + 1024
7   libsystem_pthread.dylib         0x0000000188bfb860 _pthread_body + 240
8   libsystem_pthread.dylib         0x0000000188bfb770 _pthread_body + 0
9   libsystem_pthread.dylib         0x0000000188bf8dbc thread_start + 4

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000170246c30   x1: 0x0000000170246c30   x2: 0x0000000000000008   x3: 0x0000000188b7c250
    x4: 0x0000000100e099a4   x5: 0x0000000100df14f8   x6: 0x0000000000000065   x7: 0x0000000170287c78
    x8: 0x000000059480bea8   x9: 0x0000000ffffffff8  x10: 0x0000000000000001  x11: 0xbaddc0dedeadbead
   x12: 0x0000000000000177  x13: 0x0000000000000177  x14: 0x0000000100be6a30  x15: 0x0000000000000000
   x16: 0x0000000100e19b54  x17: 0xb000000000000003  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x0000000100e94060  x21: 0x00000001ae195ef8  x22: 0x000000017046cf40  x23: 0xb000000000000003
   x24: 0x0000000000000000  x25: 0x0000000000000000  x26: 0x0000000000000004  x27: 0x0000000100be6a30
   x28: 0x0000000170246c30   fp: 0x000000016fd46b60   lr: 0x00000001000c4d88
    sp: 0x000000016fd46870   pc: 0x0000000100e19b6c cpsr: 0x20000000

Change Swift Compiler optimization Level to 将Swift编译器优化级别更改为

Fast, Single File Optimization 快速的单文件优化

instead of whole module! 而不是整个模块! 看到突出显示 Something seems unusual with whole module optimization and Alamofire! 整个模块优化和Alamofire似乎有些不同寻常!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 存档的应用仅在iOS 5.1上崩溃,而不在5.0上崩溃 - Archived app crashes only on iOS 5.1 not on 5.0 应用程序在运行已存档的导出的.ipa时崩溃,但可在模拟器上运行并将其侧面加载到设备上 - App crashes while running the archived exported .ipa but works on simulator and side loading the app onto device 通过 Testflight 归档和安装应用程序时,iOS Firebase crashlytics 仪表板不显示崩溃 - iOS Firebase crashlytics dashboard does not show crashes when app archived and installed via Testflight 本地化的应用程序仅在非基本语言上崩溃,并且仅在不与Xcode一起运行时崩溃 - Localized app crashes only on non-base language and only when not running with Xcode 在iPhone上运行时,应用程序崩溃,例外情况 - App crashes when running on iPhone with violations as exception SandboxViolation:WatchOS 应用在设备上运行时崩溃 - SandboxViolation: WatchOS app crashes when running on device Alamofire请求在连接速度慢时使我的应用程序崩溃 - Alamofire request crashes my app on slow connection 仅当连接到XCode时,应用程序才会崩溃 - App crashes ONLY when connected to XCode 在iPhone vs模拟器上运行应用程序时,应用程序崩溃 - App crashes when running app on iphone vs simulator 使用Xcode 7构建并提交时,iOS Testflighted App在仅运行iOS8的iPhone 4s上的启动屏幕上崩溃 - iOS Testflighted App crashes at the launch screen, on iPhone 4s running iOS8 only, when built+submitted with Xcode 7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM