iOS 12.4.1 发布导致 iPad 设备被苹果商店拒绝崩溃

标签 ios swift iphone alamofire appstore-approval

你好,我是 IOS swift 的新手,

我的应用程序在 iPhone/iPad 模拟器上运行良好,但是,我收到了来自苹果应用商店的应用程序拒绝消息。

我认为崩溃原因是调用 api,因为根据拒绝消息,他们尝试使用电子邮件和密码登录,一旦他们点击提交按钮,应用程序就会崩溃,应用程序在提交按钮点击时我们调用了登录API。

苹果的崩溃报告

{"app_name":"gogetGONE","timestamp":"2019-09-24 13:37:46.50 -07
    00","app_version":"6.0","slice_uuid":"5958bf7b-689e-306b-8b81-0ad61cdb32b2","adam_id":1466582359,"build_version":"1","bundleID":"com.gogetgone.gogetgonepro","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 12.4.1 (16G102)","incident_id":"D1DE09EF-3CC3-47C8-A03B-49108C8B3BFC","name":"gogetGONE"}
    Incident Identifier: D1DE09EF-3CC3-47C8-A03B-49108C8B3BFC
    CrashReporter Key:   c201dc074338fd6214efc8c4bfbbe19377d79d89
    Hardware Model:      xxx
    Process:             gogetGONE [4259]
    Path:                /private/var/containers/Bundle/Application/E7D0CB5E-929F-43F5-AEA9-400B122CD35E/gogetGONE.app/gogetGONE
    Identifier:          com.gogetgone.gogetgonepro
    Version:             1 (6.0)
    AppStoreTools:       11A1002b
    Code Type:           ARM-64 (Native)
    Role:                Non UI
    Parent Process:      launchd [1]
    Coalition:           com.gogetgone.gogetgonepro [1698]


    Date/Time:           2019-09-24 13:37:46.3466 -0700
    Launch Time:         2019-09-24 13:20:36.4938 -0700
    OS Version:          iPhone OS 12.4.1 (16G102)
    Report Version:      104

    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000001, 0x0000000102e50348
    Termination Signal: Trace/BPT trap: 5
    Termination Reason: Namespace SIGNAL, Code 0x5
    Terminating Process: exc handler [4259]
    Triggered by Thread:  0

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0 Crashed:
    0   gogetGONE                       0x0000000102e50348 0x102df8000 + 361288
    1   gogetGONE                       0x0000000102e1c1f0 0x102df8000 + 147952
    2   Alamofire                       0x0000000102f4a920 0x102f1c000 + 190752
    3   Alamofire                       0x0000000102f2d074 0x102f1c000 + 69748
    4   libdispatch.dylib               0x0000000182983a38 0x182924000 + 391736
    5   libdispatch.dylib               0x00000001829847d4 0x182924000 + 395220
    6   libdispatch.dylib               0x0000000182932008 0x182924000 + 57352
    7   CoreFoundation                  0x0000000182ed732c 0x182e2d000 + 697132
    8   CoreFoundation                  0x0000000182ed2264 0x182e2d000 + 676452
    9   CoreFoundation                  0x0000000182ed17c0 0x182e2d000 + 673728
    10  GraphicsServices                0x00000001850d279c 0x1850c8000 + 42908
    11  UIKitCore                       0x00000001af5c4c38 0x1aed08000 + 9161784
    12  gogetGONE                       0x0000000102dff9f4 0x102df8000 + 31220
    13  libdyld.dylib                   0x00000001829958e0 0x182994000 + 6368

代码片段 信息.Plist。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

登录.swift

func save() {
    let parameters: Parameters = [
        "email": self.emailTextField.text!,
        "password": self.passwordTextField.text!,
    ]
    loginButton.isEnabled = false
    Alamofire.request(ApiRequest.API_URL+"/auth/login", method : .post,parameters:parameters).responseJSON { response in
        if((response.result.value) != nil) {
            let json = JSON( response.result.value!)
            print("JSON: \(json)") // serialized json response
            if(json["success"].boolValue){
                //TODO login login
                self.gotoHome()
            }
            else{
                self.showAlert(for: json["message"].stringValue)
            }
        }
    }

}

最佳答案

您的信息 plist 应该包含实时服务器的 DNS,而不是 localHost

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

据我所知,它可能是零响应或类型转换导致了问题。

  • 首先替换

        if((response.result.value) != nil)
    

    if let swiftyResponse=response, swiftyResponse.result.value !=nil { 
     guard let json = swiftyResponse.result.value else{return }}
    
  • 进一步验证json["success"].boolValue是否确实返回bool值或者success包含字符串或Integer等。

  • 更多检查您的 self.gotoHome 方法,我建议您将其也发布到您的代码中

关于iOS 12.4.1 发布导致 iPad 设备被苹果商店拒绝崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58097448/

相关文章:

ios - 列出 Cocos2D 应用程序中所有事件节点/ Action /动画

swift - Realm 中的混合列表

iphone - 在没有重新加载数据的情况下强制在表中进行屏幕更新

iphone - 在线程中运行套接字流

iphone - 避免 UITableViewCell 的背景 View 忽略单元格边界

ios - 在 iOS 上以小型大写字母排版字体

设备锁定时的 iOS 推送通知操作

ios - iOS 有暂停 UIImageView 动画的功能吗?

ios 8 ScrollView 切断内容的宽度

ios - 如何正确分配SKSpriteNode空间?