Undestanding what causes StoreKit SKErrors - ios

It is not clear to me what exactly causes the following errors:
SKError.clientInvalid
SKError.paymentInvalid
SKError.paymentNotAllowed
I am trying to write error dialogs that are informative and instructive. But since I am not sure what causes the errors, I am not sure how to be instructive.
I guess .paymentNotAllowed occurs when parental control is enabled? And .paymentInvalid occurs when an error occurs with the payment?
But I have no idea what would cause .clientInvalid.
And do I have to handle these cloud service errors for in-app purchases? If so, what would cause them?
SKError.cloudServiceRevoked
SKError.cloudServicePermissionDenied
SKError.cloudServiceNetworkConnectionFailed

Related

How to disable crash report popup from crashlytics

I want to disable this crash popup emitted from the crashlytics framework, but still send the crash.
I've seen in the doc that you can filter the dispatch using "CrashlyticsDelegate" but I can't figure out how to shut down this. (also the doc last update is Last updated: 2017-01-20, am I missing something here o.O)
Also using strings I see some methods such as:
alertWithTitle:message:delegate:cancelButtonTitle:otherButtonTitle:
setupAndDisplayAlertWithTitle:message:cancel:send:alwaysSend:report:
So the questions:
Is it at least possible to disable it?
If it is, how?
I wonder if it comes from an older version of crashlytics, explaining maybe why I'm not able to find it in the doc~
EDIT: I tested the delegate's methods provided to intercept the crash before sending it
Using - (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report; the doc says (in the header since the internet doc isn't up to date):
it is not called synchronously during initialization
it does not give you the ability to prevent the report from being submitted
the report object itself is immutable
So this one doesn't provide any way of removing the popup.
Using - (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL submit))completionHandler; the doc says (in header again):
Invoking completionHandler with NO will cause the detected report to be deleted and not submitted to Crashlytics. This is useful for implementing permission prompts, or other more-complex forms of logic around submitting crashes.
Can't disable the popup here either.
Moreover I don't see what is the point of having a "permission prompt" like they say if you can't remove theirs :(
You can disable the privacy dialog pop-up in the app settings page
https://docs.fabric.io/android/crashlytics/advanced-setup.html#use-the-privacy-dialog
Here is a screenshot of where it hides:

Terminating app because of errors. How can i minimize these app closes

I have an app without try catch. App terminates when error occurred. I want to get error logs when error happen but don't terminate the app. Is this possible to handle this errors? I searched try, guard, defer but don't know how to use? Thanks.

How to deal with errors with FIRMessaging (un)subscribeToTopic?

Sometimes when I call [[FIRMessaging messaging] subscribeToTopic:myTopic] (or unsubscribe) I see errors logged in the console. Sometimes they have error codes, and other times it's just a message like this:
Cannot unsubscribe to topic: /topics/my_topic with token: (null)
This one appears to be because it doesn't think it has a token, though usually when I see this I've already given it a token.
There is, however, no apparent programmatic way to know when an error occurred. There's no callback passed to the subscribe methods, and their return types are void. I think I read somewhere in my Googling of these errors that the library will retry on its own, but I can't find that back now, and it's not in the documentation for FIRMessaging anywhere. The error codes are also not documented anywhere that I can find.
One error code I remember seeing specifically is 5. My implementation used to simplistically re-subscribe / unsubscribe from each topic when the user changed any of them; when I modified this to only update the topic that actually changed, that particular error went away, so maybe it was complaining because I was subscribing to a topic that I was already subscribed to, and vice versa?
How do I deal with these errors? Is it true that the library will retry on its own? And can someone link to an error code listing?
You don't have to deal with errors that result from subscribe and unsubscribe, it is retried by the SDK automatically. See docs for more.
Issues with the current error messages is a known, we will improve them in future releases.

Catching the crash log on iOS

The main idea is to catch the crash log (or the reason of the error) and send it to a server.
I know that iTunes does log the crashes from the users' devices but I need to find if there's a way to get it and store it on our server.
I was trying "PlCrashReporter" and i finished implementing it (as they did on this link https://www.plcrashreporter.org/documentation/api/v1.0/example_usage_iphone.html).
Problem
The function applicationDidFinishLaunching is not called when the crash occurs.
Am I on the right track?
Is there a specific function which is called upon a crash in AppDelegate ?
Thanks in advance
EDIT
I've also tried the solution of the following question:
iOS crash log catch, debug info.. Catch and send via email to the Dev team
It actually works but there are some errors that are cause by Swift and not Objective-C (Like Error while unwrapping optional value) were not caught..
Any suggestions?
You should use Crashlytics. You then can use a custom web hook to receive the crash reports.

unable to start billing service

i'm trying to implement in-app billing in my app.
i'm using code from dungeons sample.
everything is working great and i can purchase.
but after i leave the app i get Error "app has stopped working"
and in the LogCat i see.
05-10 14:33:22.293: E/AndroidRuntime(9568): java.lang.RuntimeException: Unable to start service com.package.name.BillingService#2beca0b0 with null: java.lang.NullPointerException
anybody knows what can cause that problem?
edit-1: the problem is that the billingService is still active. and onStart is trying to send null intents (i can solve this by if null==intent ,but it's not the way)
i'm using the unbind when i'm finished purchase.
thanks.

Resources