Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios JSONDecoder在TestFlight/AppStore上崩溃_Ios_Swift_Xcode_Testflight_Watchos - Fatal编程技术网

Ios JSONDecoder在TestFlight/AppStore上崩溃

Ios JSONDecoder在TestFlight/AppStore上崩溃,ios,swift,xcode,testflight,watchos,Ios,Swift,Xcode,Testflight,Watchos,我正在开发我的Apple Watch应用程序。我的大多数组件都使用JSON,并使用Swift可编码协议来解码JSON。 现在我想准备我的发布版,但我收到了一个测试人员的消息,说他的第三季应用程序总是崩溃 在我的系列3上安装了TestFlight构建之后,我可以重现这个问题。 TestFlight中的崩溃日志和从我的iPhone中提取的崩溃日志表明,JSON解码时发生了崩溃 我有相当复杂的JSON结构,但自从上次更新以来,我没有对它们做任何更改。此外,解码JSON在Xcode构建(也在系列3)和更

我正在开发我的Apple Watch应用程序。我的大多数组件都使用JSON,并使用Swift可编码协议来解码JSON。 现在我想准备我的发布版,但我收到了一个测试人员的消息,说他的第三季应用程序总是崩溃

在我的系列3上安装了TestFlight构建之后,我可以重现这个问题。 TestFlight中的崩溃日志和从我的iPhone中提取的崩溃日志表明,JSON解码时发生了崩溃

我有相当复杂的JSON结构,但自从上次更新以来,我没有对它们做任何更改。此外,解码JSON在Xcode构建(也在系列3)和更新的苹果手表(系列4+5)上运行良好。我正在努力找出问题的原因。 我在苹果开发者论坛上发现了一个类似的问题,但没有解决方案:

以下是我的崩溃日志的堆栈跟踪的一部分:

Date/Time:           2020-02-05 08:37:42.9924 +0100
Launch Time:         2020-02-05 08:37:40.0000 +0100
OS Version:          Watch OS 6.1.2 (17S5792a)
Release Type:        User
Baseband Version:    4.40.02
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

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x4d9aefc8 __pthread_kill + 8
1   libsystem_pthread.dylib         0x4da260be pthread_kill + 108
2   libsystem_c.dylib               0x4d9383a4 abort + 84
3   libswiftCore.dylib              0x6cffbade swift_vasprintf+ 2341598 (char**, char const*, char*) + 0
4   libswiftCore.dylib              0x6d00932c swift::TargetMetadata<swift::InProcess>::getGenericArgs+ 2396972 () const + 0
5   libswiftCore.dylib              0x6d00508c _swift_initClassMetadataImpl+ 2379916 (swift::TargetClassMetadata<swift::InProcess>*, swift::ClassLayoutFlags, unsigned long, swift::TypeLayout const* const*, unsigned long*, bool) + 28
6   libswiftCore.dylib              0x6d005c86 swift_initClassMetadata2 + 22
7   libswiftCore.dylib              0x6cfdc6fc type metadata completion function for _KeyedDecodingContainerBox + 50
8   libswiftCore.dylib              0x6d00a6c2 swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization+ 2401986 (swift::ConcurrencyControl&, swift::MetadataCompletionQueueEntry*, swift::MetadataRequest) + 178
9   libswiftCore.dylib              0x6d003a0c swift_getGenericMetadata + 1124
10  libswiftCore.dylib              0x6cdf4210 KeyedDecodingContainer.init<A>+ 213520 (_:) + 40
11  libswiftFoundation.dylib        0x6d156e0a __JSONDecoder.container<A>+ 323082 (keyedBy:) + 678
12  libswiftFoundation.dylib        0x6d1a3a1c protocol witness for Decoder.container<A>+ 637468 (keyedBy:) in conformance __JSONDecoder + 18
13  libswiftFoundation.dylib        0x6d1592b6 protocol witness for Decoder.container<A>+ 332470 (keyedBy:) in conformance __JSONDecoder + 32
14  libswiftCore.dylib              0x6cfdb1cc dispatch thunk of Decoder.container<A>+ 2208204 (keyedBy:) + 24
15  WatchSonos WatchKit Extension   0x00440bf2 0x358000 + 953330
16  WatchSonos WatchKit Extension   0x0043d08c 0x358000 + 938124
17  libswiftCore.dylib              0x6cfdb156 dispatch thunk of Decodable.init+ 2208086 (from:) + 12
18  libswiftFoundation.dylib        0x6d16fbee __JSONDecoder.unbox_+ 424942 (_:as:) + 4014
19  libswiftFoundation.dylib        0x6d156816 JSONDecoder.decode<A>+ 321558 (_:from:) + 642
20  libswiftFoundation.dylib        0x6d22af98 dispatch thunk of JSONDecoder.decode<A>+ 1191832 (_:from:) + 28
21  WatchSonos WatchKit Extension   0x0045db0c 0x358000 + 1071884
22  WatchSonos WatchKit Extension   0x00461cce 0x358000 + 1088718
23  WatchSonos WatchKit Extension   0x00461bde 0x358000 + 1088478
24  WatchSonos WatchKit Extension   0x00420ffa 0x358000 + 823290
25  WatchSonos WatchKit Extension   0x00425914 0x358000 + 842004
26  libdispatch.dylib               0x4d851846 _dispatch_call_block_and_release + 10
27  libdispatch.dylib               0x4d8528b8 _dispatch_client_callout + 6
28  libdispatch.dylib               0x4d85c6b0 _dispatch_main_queue_callback_4CF + 868
29  CoreFoundation                  0x4dcdbbaa __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 10
30  CoreFoundation                  0x4dcd7c00 __CFRunLoopRun + 1832
31  CoreFoundation                  0x4dcd723a CFRunLoopRunSpecific + 370
32  GraphicsServices                0x50aebcd0 GSEventRunModal + 96
33  UIKitCore                       0x65c91580 UIApplicationMain + 1730
34  libxpc.dylib                    0x4da73c80 _xpc_objc_main.cold.3 + 152
35  libxpc.dylib                    0x4da649b0 _xpc_objc_main + 184
36  libxpc.dylib                    0x4da668c4 xpc_main + 110
37  Foundation                      0x4e56b0c6 +[NSXPCListener serviceListener] + 0
38  PlugInKit                       0x556d726c 0x556c5000 + 74348
39  WatchKit                        0x5cfe9afe WKExtensionMain + 62
40  WatchKit                        0x5d09f020 main + 10
日期/时间:2020-02-05 08:37:42.9924+0100
发射时间:2020-02-05 08:37:40.0000+0100
操作系统版本:观看操作系统6.1.2(17S5792a)
发布类型:用户
基带版本:4.40.02
报告版本:104
异常类型:EXC_崩溃(SIGABRT)
异常代码:0x0000000000,0x0000000000000000
例外说明:EXC_尸体通知
由以下线程触发:0
特定于应用程序的信息:
调用了abort()
线程0名称:调度队列:com.apple.main-Thread
线程0崩溃:
0 libsystem_kernel.dylib 0x4d9aefc8_uupthread_kill+8
1 libsystem_pthread.dylib 0x4da260be pthread_kill+108
2 libsystem_c.dylib 0x4d9383a4中止+84
3 libswiftCore.dylib 0x6cffbade swift_vasprintf+2341598(字符**,字符常量*,字符*)+0
4 libswiftCore.dylib 0x6d00932c swift::TargetMetadata::getGenericArgs+2396972()常量+0
5 libswiftCore.dylib 0x6d00508c_swift_initClassMetadataImpl+2379916(swift::TargetClassMetadata*,swift::ClassLayoutFlags,无符号长,swift::TypeLayout常量*常量*,无符号长*,bool)+28
6 libswiftCore.dylib 0x6d005c86 swift_initClassMetadata2+22
7 _KeyedDecodingContainerBox+50的libswiftCore.dylib 0x6cfdc6fc类型元数据完成函数
8 libswiftCore.dylib 0x6d00a6c2 swift::MetadataCacheEntryBase::doInitialization+2401986(swift::Concurrency Control&,swift::MetadataCompletionQueueEntry*,swift::MetadataRequest)+178
9 libswiftCore.dylib 0x6d003a0c swift_getGenericMetadata+1124
10 libswiftCore.dylib 0x6cdf4210 KeyedDecodingContainer.init+213520(:)+40
11 libswiftftffoundation.dylib 0x6d156e0a _ujsondecoder.container+323082(keyedBy:)+678
12解码器的libswiftftffoundation.dylib 0x6d1a3a1c协议见证。容器+637468(keyedBy:)符合性\uuu JSONDecoder+18
13解码器的libswiftftffoundation.dylib 0x6d1592b6协议见证。容器+332470(keyedBy:)符合性\uuu JSONDecoder+32
14 libswiftCore.dylib 0x6cfdb1cc解码器调度thunk.container+2208204(keyedBy:)+24
15手表SONOS手表套件分机0x00440bf2 0x358000+953330
16手表SONOS手表套件分机0x0043d08c 0x358000+938124
17 libswiftCore.dylib 0x6cfdb156可解码.init的调度thunk+2208086(from:)+12
18 libswiftftffoundation.dylib 0x6d16fbee uuu JSONDecoder.unbox_uu+424942(uu:as:)+4014
19 libswiftftfoundation.dylib 0x6d156816 JSONDecoder.decode+321558(从:)+642
20 libswiftffoundation.dylib 0x6d22af98 JSONDecoder.decode的调度thunk+1191832(:from:)+28
21手表SONOS手表套件扩展0x0045db0c 0x358000+1071884
22手表SONOS手表套件分机0x00461CE 0x358000+1088718
23手表SONOS手表套件扩展0x00461bde 0x358000+1088478
24手表SONOS手表套件分机0x00420ffa 0x358000+823290
25手表SONOS手表套件扩展0x00425914 0x358000+842004
26 libdispatch.dylib 0x4d851846调度调用块和释放+10
27 libdispatch.dylib 0x4d8528b8 _dispatch_client_callout+6
28 libdispatch.dylib 0x4d85c6b0_dispatch_main_queue_callback_4CF+868
29 CoreFoundation 0x4DCDBAA\uuuu CFRUNLOOP\u正在为\u主\u调度\u队列\uuuuu+10提供服务
30 CoreFoundation 0x4dcd7c00\uuu CFRunLoopRun+1832
31 CoreFoundation 0x4dcd723a CFRunLoopRunSpecific+370
32图形服务0x50aebcd0 GSEventRunModal+96
33 UIKitCore 0x65c91580 UIApplicationMain+1730
34 libxpc.dylib 0x4da73c80_xpc_objc_main.cold.3+152
35 libxpc.dylib 0x4da649b0\u xpc\u objc\u main+184
36 libxpc.dylib 0x4da668c4 xpc_main+110
37基金会0x4E56B0C6+ [ NSXPCListener serviceListener ] + 0
38 PlugInKit 0x556d726c 0x556c5000+74348
39手表套件0x5cfe9afe WKExtensionMain+62
40手表套件0x5d09f020主+10
以下是代码中崩溃的位置:

required public init(来自解码器:解码器)抛出{
let values=try decoder.container(keyedBy:CodingKeys.self)
self.id=try values.decode(String.self,forKey:.id)
做{
if values.contains(.groups){
let groups=try values.decode(Dictionary.self,forKey:.groups)
self.groups=组
}
如果值。包含(.players){
let players=try values.decode(Array.self,forKey:.players)
self.players=玩家
}
}捕捉错误{
打印(“错误解码组\(错误)”)
}
}
对我来说,这看起来像是苹果的一个bug,我为此提交了反馈,但这并不是下一版本的解决方案

有人知道他们之间的区别吗