Milkmangames Easypush ANE, can an OS cancel click be detected - ios

I am calling
EasyPush.oneSignal.registerForNotifications();
At a relevant time in my program to initiate the iOS subscribe to push messages dialogue. If the user clicks OK I get a an event confirming acceptance and giving me the token.
However if the user clicks Cancel in the OS dialogue I do not get anything, if the user presses Cancel I wish to respond to this.
Can Cancel be detected?
I think this is the same issues as calling the register when Cancel has been previously pressed, because again nothing happens.
EDIT,
When a user clicks 'Agree' then the registered event occurs
PNOSEvent.TOKEN_REGISTERED
However, when 'Dont Agree' is clicked nothing happens, an event exists called
PNOSEvent.TOKEN_REGISTRATION_FAILED
However this never occurs and I do not know why, but if this event did occurs it would be what I am looking for.

Directly from MilkmanGames themselves:
"Apple actually doesn't give us a notification for this case. What you could do is set a timeout (and/or listen for the next Event.ACTIVATE) and use the EasyPush.areNotificationsEnabled() function."

Related

App Tracking Transparency reset after user choice

I've just implemented the ATT request in my applications. It appears at the app first opening but I would like to show it again if the user wants to change his preferences from the app settings (internal).
I tried to call the requestTrackingAuthorization method again but it enters immediately to the completion handler. Is there a way to reset the status?

How to detect when user has declined to enable Location Services more than 2 times?

When calling the requestWhenInUseAuthorization method of CLLocationManager, if the user has disabled Location Services, iOS displays an alert that says:
Turn On Location Services to Allow "Your App Name" to Determine Your
Location
This alert has a Settings button that takes the user to "Location Services" in the Settings app, and a Cancel button.
This alert is great, but the problem I'm having is that it only displays up to 2 times. If the user clicks Cancel both times, then the next time I call requestWhenInUseAuthorization, no alert is displayed.
I would like to at least tell the user what the problem is in this scenario, but I don't know how to detect this scenario.
You have to save the number of authorization requests yourself.
The simplest way would be to use UserDefaults. Like this:
Save value:
UserDefaults.standard.set(true, forKey: "DidRequestAuthorization")
Load value:
let didRequestAuthorization = UserDefaults.standard.bool(forKey: "DidRequestAuthorization")
Then if didRequestAuthorizationis true you can display an alert next time that warns the user to cancel the request.
This alert is great, but the problem I'm having is that it only displays up to 2 times. If the user clicks Cancel both times, then the next time I call requestWhenInUseAuthorization, no alert is displayed.
As you rightly observe, you cannot rely on the system alert. But you don't have to. You can tell whether the user has disabled core location completely by calling the CLLocationManager class method locationServicesEnabled. You can then present your own alert.

How to handle rapid like/unlike at updating UI ios

I have an app. In this app, a user can like/unlike something. If the user tap the button like, it would change text to unlike, vice versa.
To make the like/unlike event run seamlessly to user, i change the text first, and then make request to my API, saying that the user like/unlike this. The API decides whether the action is liking or unliking depends on value at database. The API then returns a message stating the action made ("liked"/"unliked"). The app receives it, and then update the UI according to the result, in case the action intended by user fails.
If all runs smoothly, the user won't detect the changes made by API result.
This is the flow of liking something
user like -> button text changes to "unlike"
-> app make a request -> request is queued to operation queue
-> request run -> API decides whether that something is liked/unliked by the user
-> API returns action (in this case, "liked") -> app updates button text ("unlike")
Now my question are:
How do I handle rapid button tap by user?
How do I handle failed requests (internet disconnected, or no signal) while handling the problem no. 1?
nb: I don't want to disable the button (the app has to run seamlessly. Facebook app don't do it either, i just checked). Oh, and I use AFHTTPRequestOperationManager and set its maxConcurrentOperationCount to 1.
I resolved my problem using this answer
with a bit modification. The first time user click the button, I set a request flag to false, so that even if the user click the button many times, request won't be made before the first request is done.

Cancelled Touch ID returns unknown error, not cancelled

Long time reader, first time writer. Thanks for a great community.
The app I am working on has In-App Purchase implemented and is working well, however I've run into a strange error case that I don't see an obvious solution to.
The scenario is seen on iPhone 5S with Touch ID enabled for purchases. When the user selects an item to purchase, the Touch ID dialog pops up. If user cancels this specific dialog, the SKPayment delegate receives a SKPaymentTransactionStateFailed event with SKErrorUnknown code - not SKErrorPaymentCancelled as one would expect and what is received when I cancel the password input dialog. As the code cannot categorize this as the user canceling the purchase, the user will see a generic error alert view.
I don't see this being a sandbox issue as purchases themselves works well both testing in sandbox and live.
Thoughts on how to detect that unknown error as a cancellation, anyone?

Detect user's confirmation of iPhone call link?

The following code, if triggered by a button press in an app, presents the user with a UIAlertView giving them the option to "Cancel", and dismiss the UIAlertView, or "Call" and go through with dialing the number displayed to the user:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt://555-555-5555"]];
My question is: Is there a way to detect whether or not the user followed through with actually dialing the number? I am implementing Google "Analytics" in my app to see how users are interacting with it, and I can track when they tap the UIButton that calls the code above, but that doesn't necessarily mean they actually made the call.
Hopefully that makes sense. Thanks in advance for any help!
You won't be able to check the user dialed that specific number. But you will be able to check they dialed a number using CTCallCenter:setCallEventHandler:
If they made a call immediately after you present the view its 99.9% reasonable to assume it was that number.
But also your app delegate's willResignActive will get called if they place the call and get connected (I think, I can't remember exactly) so you could use that as an indication.

Resources