ios - 应用程序在苹果审核时崩溃,但在本地开发时不会崩溃

标签 ios swift crash

当 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

知道如何在本地开发上重现崩溃或什么可能导致此崩溃吗?

最佳答案

谢谢大家, 重写应用程序以删除所有强制展开修复了崩溃

关于ios - 应用程序在苹果审核时崩溃,但在本地开发时不会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55533604/

相关文章:

regex - 我如何找到用 NSRegularExpression 写的泰语单词

c++ - 用于 IOS 的英特尔 tbb

iPhone:可变长度的UILabel,多行字符串,多种字体

ios - 我们可以在 iOS 中为一个 App 设置多个 Apple 推送通知设置作为日历 App

ios - 类型 "Int -> Bool","Int-> Bool -> Int","Int-> String -> Int-> Bool"

apache - 启动由 perl 脚本调用的外部二进制文件时出现奇怪的 apache 行为

ios - 索引 7 超出空有序集的范围 - 刷新控制问题

swift - 在 Swift 中使用 UIImapgePickerController 时如何获取所选图像的 URL?

iphone - 高速缓存镜像中的内存警告错误

android - 按下计算按钮时,bmi应用程序崩溃