我看到很少有用户崩溃,但Alamofire响应处理程序中却崩溃了。任何帮助表示赞赏。
感觉可能取决于服务器端的结果,但是我无法查明哪个结果可能是错误的……并且鉴于所有解析都在try catch中,所以我不清楚为什么会崩溃。
这是报告为EXC_BREAKPOINT的堆栈:
0 libswiftFoundation.dylib 0x23958417c __DataStorage.init(bytes:length:) + 280
1 Alamofire 0x101207ed0 specialized Data.InlineSlice.init(_:) (<compiler-generated>)
2 Alamofire 0x101207f78 specialized Data._Representation.init(_:) (<compiler-generated>)
3 Alamofire 0x1011df918 closure #1 in static DownloadRequest.dataResponseSerializer() + 320 (ResponseSerialization.swift:320)
4 Alamofire 0x1011df9f0 specialized thunk for @escaping @callee_guaranteed (@in_guaranteed URLRequest?, @guaranteed NSHTTPURLResponse?, @in_guaranteed URL?, @guaranteed Error?) -> (@owned Result<Data>) (<compiler-generated>)
5 Alamofire 0x1011dbdcc specialized closure #1 in DownloadRequest.response<A>(queue:responseSerializer:completionHandler:) + 224 (ResponseSerialization.swift:224)
6 Alamofire 0x1011bd0a0 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
7 Foundation 0x20bcbdef8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8 Foundation 0x20bbca3e0 -[NSBlockOperation main] + 72
9 Foundation 0x20bbc98c8 -[__NSOperationInternal _start:] + 740
10 Foundation 0x20bcbfc7c __NSOQSchedule_f + 272
11 libdispatch.dylib 0x20ac7a1cc _dispatch_block_async_invoke2 + 104
12 libdispatch.dylib 0x20ac997d4 _dispatch_client_callout + 16
13 libdispatch.dylib 0x20ac70c34 _dispatch_continuation_pop$VARIANT$armv81 + 404
14 libdispatch.dylib 0x20ac70314 _dispatch_async_redirect_invoke + 592
15 libdispatch.dylib 0x20ac7c9d4 _dispatch_root_queue_drain + 340
16 libdispatch.dylib 0x20ac7d248 _dispatch_worker_thread2 + 116
17 libsystem_pthread.dylib 0x20ae791b4 _pthread_wqthread + 464
18 libsystem_pthread.dylib 0x20ae7bcd4 start_wqthread + 4
使用Swift 5面向iOS 11构建主要应用以及Alamofire Pods。AlamofireObjectMapper正在使用Swift 4构建
使用以下Pod:
- Alamofire (4.8.2)
- AlamofireImage (3.5.2):
- Alamofire (~> 4.8)
- AlamofireNetworkActivityIndicator (2.4.0):
- Alamofire (~> 4.8)
- AlamofireNetworkActivityLogger (2.4.0):
- Alamofire (~> 4.8)
- AlamofireObjectMapper (5.2.0):
- Alamofire (~> 4.7)
答案 0 :(得分:0)
我有同样的问题。 就我而言,这仅在我使用“数据”结构时发生。 控制台输出错误如下
malloc: can't allocate region
*** mach_vm_map(size=920813568) failed (error code=3)
malloc: *** set a breakpoint in malloc_error_break to debug
“ malloc:无法分配区域”与内存泄漏问题有关。