首页 > 解决方案 > 应用程序在 Apple Review 中崩溃,但在本地开发中没有

问题描述

该应用程序在 Apple 团队审查时崩溃,但在开发时无法重现崩溃。

我尝试在所有可能的模拟器中运行它,还尝试了 Amazon AWS Device Farm 和 2 种不同的真实设备(iPad 和 iPhone)。

DateFormater 似乎无法解析日期并返回 nil,在此之前我们已经解析了一些其他字段,但没有日期。

我们认为格式应该是指定的(我们可以在我们的设备上解析它)并且我们使用与苹果审查团队相同的帐户。

我们还尝试将日历切换为非公历,这也没有使应用程序崩溃。

该应用程序self.modified = ...在行上崩溃

从 Event.swift ...

import SwiftyJSON
...
  required init(json: JSON) {
    self.id = json["tm_event_id"].int!;
    self.name = json["name"].string!;
    self.eventStatus = EventStatus.init(rawValue: json["event_status"].string!)!;
    self.modified = AppDelegate.formaterDatetime.date(from: json["modified"].string!)!;
    self.dateFrom = AppDelegate.formaterDate.date(from: json["date_from"].string!)!;
...
  }

从 AppDelegate.swift ...

  static var formaterDatetime:DateFormatter {
    let f = DateFormatter();
    f.dateFormat = "yyyy-MM-dd HH:mm:ss";
    f.timeZone = dataTimeZone
    f.locale = Calendar.current.locale;
    return f;
  }

后端响应(基于我们的服务器日志)

[
  {
    "tm_event_id": 1082,
    "company_id": 16,
    "organization_id": 58,
    "org_user_id": 126,
    "org_location_id": 93,
    "name": "My Test",
    "date_from": "2019-03-25",
    "date_to": "2019-03-30",
    "week_ending": "2019-03-31",
    "placement_count": 6,
    "notes": "",
    "event_status": "private",
    "created": "2019-03-04 13:25:25",
    "modified": "2019-03-04 13:25:25",
    "subrequirements": [ ... ],
    "timesheets": [ ... ]
  }

崩溃日志

Crashed: com.apple.root.user-initiated-qos
0  YouRecruit Work Tracker        0x1028b9470 specialized Event.init(json:) (Event.swift:224)
1  YouRecruit Work Tracker        0x10286424c specialized static StorableItem.initStatic(json:) (Event.swift)
2  YouRecruit Work Tracker        0x102844b20 closure #3 in _TempManAPI.().init() (<compiler-generated>)
3  YouRecruit Work Tracker        0x102844c4c specialized thunk for @escaping @callee_guaranteed (@guaranteed Entity<JSON>) -> (@owned [Event]?, @error @owned Error) (<compiler-generated>)
4  Siesta                         0x102e22a0c (Missing)
5  Siesta                         0x102e2250c (Missing)
6  Siesta                         0x102df4700 (Missing)
7  Siesta                         0x102df9c70 (Missing)
8  Siesta                         0x102df96fc (Missing)
9  Siesta                         0x102df163c (Missing)
10 Siesta                         0x102de9fbc (Missing)
11 libdispatch.dylib              0x222a44a38 _dispatch_call_block_and_release + 24
12 libdispatch.dylib              0x222a457d4 _dispatch_client_callout + 16
13 libdispatch.dylib              0x2229f6160 _dispatch_root_queue_drain + 680
14 libdispatch.dylib              0x2229f68d0 _dispatch_worker_thread2 + 128
15 libsystem_pthread.dylib        0x222c251b4 _pthread_wqthread + 464
16 libsystem_pthread.dylib        0x222c27cd4 start_wqthread + 4

知道如何在本地开发人员上重现崩溃或导致此崩溃的原因吗?

标签: iosswiftcrash

解决方案


感谢所有人,重写应用程序以删除所有强制解包修复了崩溃


推荐阅读