2017-02-20 1 views
-4

구독 기반 인앱 구매와 관련이 있다고 생각됩니다. 모든 것은 개발 모드와 TestFlight에서 제대로 작동하며 심지어 Ad Hoc을 실행합니다. 그러나 앱 스토어를 공격 할 때마다 매번 충돌이 일어난다.내 앱이 App Store에서 충돌하지만 개발되지 않은 이유는 무엇입니까?

나는 충돌 로그를 확인했으며, 내가 얻는 유일한 정보는 SIGTRAP이라는 것입니다.

func checkForSubscription { 

    print("Checking subscription status") 

    guard let receiptURL = Bundle.main.appStoreReceiptURL else { 
     return 
    } 

    let fileManager = FileManager() 
    if fileManager.fileExists(atPath: receiptURL.path) { 

     do { 

      let receipt = try! Data(contentsOf: receiptURL) 

      let requestContents = [ 
       "receipt-data": receipt.base64EncodedString(options: []), 
       "password": "secret generated from iTunes Connect" 
      ] 

      let requestData = try JSONSerialization.data(withJSONObject: requestContents, options: []) 
      let storeURL = URL(string: "https://buy.itunes.apple.com/verifyReceipt") 
      let sandboxURL = URL(string: "https://sandbox.itunes.apple.com/verifyReceipt") 

      var request = URLRequest(url: storeURL!) 
      request.httpMethod = "POST" 
      request.httpBody = requestData 

      let task = URLSession.shared.dataTask(with: request) { data, response, error in 
       guard let httpResponse = response as? HTTPURLResponse, let receivedData = data else { 
        print("No valid http response.") 
        return 
       } 
       switch (httpResponse.statusCode) { 
       case 200: 
        do { 
         let data = try JSONSerialization.jsonObject(with: receivedData, options: .allowFragments) 

         let json = JSON(data) // SwiftyJSON 
         let receipts = json["receipt"]["in_app"].array! 
         let latestReceipts = json["latest_receipt_info"].array! 

         var allReceipts = receipts + latestReceipts 

         var expiresTime: Double = 0 

         for receipt in allReceipts { 
          let expiration = receipt["expires_date_ms"].doubleValue/1000 
          if expiration > expiresTime { 
           expiresTime = expiration 
          } 
         } 

         let currentTime = NSDate().timeIntervalSince1970 
         let expired = currentTime > expiresTime 

         if expired { 
          subscribed = false 
         } else { 
          subscribed = true 
         } 

        } catch { 
         print(error) 
        } 
       default: 
        print("Error code: \(httpResponse.statusCode)") 
       } 
      } 
      task.resume() 

     } catch { 
      // May be because there is no history of subscription 
      print(error) 
     } 

    } else { 
     print("no receipt") 
    } 

} 
+1

어떤 라인이 충돌하나요? - 또한 감탄사 표를 붙일 때마다 "나를 부숴 버리는"것을 당신은 알고 있지, 그렇지 않니? 적어도 네 개가 보인다. 그것은 분명히 "이 일을 올바르게"한다고 설명 될 수는 없습니다. – matt

+2

모든 상징적 인 충돌 보고서 – Kerni

+0

을 제공하십시오. "매번 충돌합니다." 매번 충돌이 발생하면 Apple App Store 리뷰를 통과 한 방법은 정확하지 않습니다. 그리고 Xcode에 전화를 연결하고 충돌 로그를 가져 오지 마십시오. – Gruntcakes

답변

1

응용 프로그램이 앱 스토어에 충돌 할 경우, 당신은 당신의 전자 우편에 클래스 이름과 줄 번호를 얻을 것이다, 앱에서 다음을 Crashlytics을 통합 할 수 있습니다 응용 프로그램 :

는 나는이 코드의 생각 추락.

관련 문제