SKReceiptRefreshRequest always fails in Xcode 12.2 with .storekit configuration file - ios

When I run the app with .storekit configuration file in Xcode 12.2 / iOS 14.2 Simulator, my SKReceiptRefreshRequest always fails, I get an error in my func request(_ request: SKRequest, didFailWithError error: Error) delegate method. Here are the logs:
# Printed by some Apple internal framework:
<SKReceiptRefreshRequest: 0x60000320d640>: Finished refreshing receipt with error: Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}
# Error logged by my code:
Failed to refresh app receipt: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x600003c9a040 {Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}
I run the request as usual:
class ReceiptFetcher: NSObject {
func fetchReceipt() {
let request = SKReceiptRefreshRequest(receiptProperties: nil)
request.delegate = self
request.start()
}
}
extension ReceiptFetcher: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
LogVerbose("App receipt refreshed!")
// Handling success
}
func request(_ request: SKRequest, didFailWithError error: Error) {
LogVerbose("Failed to refresh app receipt: \(error)")
// Handling error
}
}
Everything worked fine until I upgraded Xcode to 12.2. Now it fails for both Run and Test actions.
I found nothing about ASDServerErrorDomain with code 5002. Any help on that?

Everything works again since Xcode 12.4. I hope they won't break this thing again...

Related

Firebase Task finished with error - code: -1200

I am unable to access data from Firebase storage on my iOS app on my current connection. When I connect to a VPN, it allows me to connect and download data from Firebase Storage normally. I have also tried to allow arbitrary loads but to no use. Any suggestions?
The following is the code:
let tempImageRef = storage.child("CoverArt/Issue15.jpg")
tempImageRef.getData(maxSize: 1*1000*1000) { (data, error) in
if (error == nil)
{ //Do something }
else { print(error!.localizedDescription) } }
The following is the error:
Task <D343DC6F-2D37-4246-A0BA-4044BF36C83D>.<1> finished with error - code: -1200 An unknown error occurred, please check the server response.
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

Xcode 9.2 UIDocumentBrowserViewController : Failed to create a url from bookmarkableString

Update: Xcode 9.3 has fixed it.
When creating UIDocument File in UIDocumentBrowserViewController
[default] [ERROR] Could not resolve bookmark. Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.}
[DocumentManager] Failed to create a url from bookmarkableString (Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.})
Code work well in Xcode 9.1, But Failed in Xcode 9.2. almost the same code as wwdc 2017.
func documentBrowser(_ controller: UIDocumentBrowserViewController, didRequestDocumentCreationWithHandler importHandler: #escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) {
let newDocumentURL: URL? = R.file.templateDocument()
// Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
// Make sure the importHandler is always called, even if the user cancels the creation request.
if newDocumentURL != nil {
importHandler(newDocumentURL, .copy)
} else {
importHandler(nil, .none)
}
}

Error while authorization to HealthKit - Code=100 "Rolling back the health database is unsupported."

Here is my code:
var shareTypes = Set<HKSampleType>()
shareTypes.insert(HKSampleType.categoryType(forIdentifier: .mindfulSession)!)
var readTypes = Set<HKObjectType>()
readTypes.insert(HKObjectType.categoryType(forIdentifier: .mindfulSession)!)
healthStore.requestAuthorization(toShare: shareTypes, read: readTypes) { (success, error) -> Void in
if success {
print("success")
} else {
print("failure")
}
if let error = error { print(error) }
}
Here I get error:
Error Domain=com.apple.healthkit Code=100 "Rolling back the health database is unsupported."
Cant find any information about this error, can anybody help?
I use Xcode 8.3.3 Swift 3
This indicates that you had a newer version of iOS installed on this device previously and then you rolled back to an older version. In general, rolling back is not supported accross iOS (although some parts of the system can handle it better than others). You should always erase a device before installing an older OS on it.

iOS - Firebase call neither sends error nor response

When I delete the app and run the following code -> gives the response.
But when I run the same code second time -> I get no response.
FIRDatabase.database().reference().child("wall").child(userId).queryLimited(toLast: limit).observeSingleEvent(of: .value, with: { (snapshot) in
print("response")
}) { (error) in
print(error)
debugPrint(error.localizedDescription)
}
Sometimes it throws ->
NSURLSession/NSURLConnection HTTP load failed
(kCFStreamErrorDomainSSL, -9802)
And most of the time neither the response nor the error is thrown.
Any guesses what is wrong ?
P.S:
I've my plist as:
Most amazing thing is Firebase function call is not even sending error ??

How do I correctly call refreshToken in GCM for iOS?

I have integrated my app with GCM, and it is on the store and it works fine. Now I want to refresh the registration tokens and send new tokens to my server.
GCM provides a method called refreshToken:
func onTokenRefresh() {
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler)
}
I called this method from my ApplicationBecomeActive. This calls the method:
func registrationHandler(registrationToken: String!, error: NSError!) {
if (registrationToken != nil) {
} else {
print("Registration to GCM failed with error: \(error.localizedDescription)")
let userInfo = ["error": error.localizedDescription]
NSNotificationCenter.defaultCenter().postNotificationName(self.registrationKey, object: nil, userInfo: userInfo)
}
}
But I am not getting a registrationToken. Every time it says:
Registration to GCM failed with error "registration to GCM failed with
error: The operation couldn’t be completed. (com.google.iid error
1001.)"
What is going wrong here?
As stated here, to refresh the registration token, the GGLInstanceIDDelegate protocol declares an onTokenRefresh method that is called when the system determines that tokens need to be refreshed.
Registration to GCM failed with error "registration to GCM failed with error: The operation couldn’t be completed. (com.google.iid error 1001.)" error occurs when your server is under load and not responding to requests before the HTTP(s) code gives up. Sounds like you have a configuration problem to address.
Check this GitHub issue.

Resources