adding usernotification category without permission dialog popping up - ios

Is it possible to add interactive notification categories without the notifications permissions dialog popping up? The problem is if they hit "Don't Allow" on the original notifications permissions dialog, but then later change the notification setting manually, your categories never get added and there doesn't seem to be anyway to add them back. Is there anyway to separate the two?
I've tried:
UIMutableUserNotificationAction* snoozeAction = [[UIMutableUserNotificationAction alloc] init];
[snoozeAction setIdentifier:#"snooze_action_id"];
[snoozeAction setTitle:#"Snooze"];
[snoozeAction setActivationMode:UIUserNotificationActivationModeBackground];
[snoozeAction setDestructive:NO];
[snoozeAction setAuthenticationRequired:NO];
UIMutableUserNotificationCategory* SnoozeCategory = [[UIMutableUserNotificationCategory alloc] init];
[SnoozeCategory setIdentifier:kNotifCategory];
[SnoozeCategory setActions:#[snoozeAction] forContext:UIUserNotificationActionContextDefault];
[SnoozeCategory setActions:#[snoozeAction] forContext:UIUserNotificationActionContextMinimal];
NSSet* categories = [NSSet setWithArray:#[SnoozeCategory]];
//NOT asking for permission to send any type of notifications here, just making sure our categories get saved
UIUserNotificationSettings* settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeNone categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
As you can see im setting the notification settings to UIUserNOtificationTypeNone, but the permissions dialog still pops up.

From the docs on registerUserNotificationSettings:
The first time your app launches and calls this method, the system asks the user whether your app should be allowed to deliver notifications and stores the response. Thereafter, the system uses the stored response to determine the actual types of notifications you may use.
...
Calling this method with a new user settings object replaces the previous settings request.
So I think what you can do is wrap your code in a method that gets called on each app launch (maybe in application:didFinishLaunchingWithOptions: or even applicationDidBecomeActive:). The user will only be prompted once and if they reject and enable later your new method should add the correct settings.

Related

Is it possible for an app to use touch ID without the touch ID prompt or dialog? [duplicate]

Trying to Integrate TouchId in my application, and i was successful too.
The Question is
Can we customize the Default TouchID UIalertview ?
Can we Disable it?
No, you cannot. As Popeye said in a comment, the system controls that prompt, not your app – you simply request that the system display it for you. This is due to obvious security concerns.
For example, what if you initiated a $100 in-app purchase, but changed the prompt to say, "Place your thumb on the home button to start the game!" Clearly that would not go over well.
You can customized it the message in the alert can be set with the localizedReason parameter
- (void)evaluatePolicy:(LAPolicy)policy localizedReason:(NSString *)localizedReason reply:(void (^)(BOOL success, NSError *error))reply
You can also set the action button (default is "Enter Password") with
LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = [your message]
The "localizedFallbackTitle" is not in the docs but part of the LAContext .h file

Is there any way to disable the Touch ID prompt (UIAlertview)?

Trying to Integrate TouchId in my application, and i was successful too.
The Question is
Can we customize the Default TouchID UIalertview ?
Can we Disable it?
No, you cannot. As Popeye said in a comment, the system controls that prompt, not your app – you simply request that the system display it for you. This is due to obvious security concerns.
For example, what if you initiated a $100 in-app purchase, but changed the prompt to say, "Place your thumb on the home button to start the game!" Clearly that would not go over well.
You can customized it the message in the alert can be set with the localizedReason parameter
- (void)evaluatePolicy:(LAPolicy)policy localizedReason:(NSString *)localizedReason reply:(void (^)(BOOL success, NSError *error))reply
You can also set the action button (default is "Enter Password") with
LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = [your message]
The "localizedFallbackTitle" is not in the docs but part of the LAContext .h file

how to register and use multiple interactive push categories with ios 8

Hello i successfully created a single interactive push set but when i tried to register for multiple set it only register the last settings and the previously registered ones just overwritten.
My question is how can i create multiple interactive push with different identifiers where i can provoke any of them when i wanted.
Simply use the setWithObjects method on NSSet to include both of your categories in one set object:
NSSet *set = [NSSet setWithObjects:yesNoButtonBackground, acceptDeclineBackground];
Then you only need to call registerUserNotificationSettings once:
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:types
categories:set]];

iOS- call a phone number without sharing their number

My app allows users to call another with click of a button. But user's don't want to share their number. That is when user tries to call another one , app will hide their mobile number and display only their name saved in DB or any random digits. Is it possible in iOS?
I know how to do mobile calling in iOS.
NSString *phNo = #"+912436580";
NSURL *phoneUrl = [NSURL URLWithString:
[NSString stringWithFormat:#"telprompt:%#",phNo]];
if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
[[UIApplication sharedApplication] openURL:phoneUrl];
} else
{
UIAlertView *calert = [[UIAlertView alloc]
initWithTitle:#"Alert"
message:#"Call facility is not available!!!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil, nil];
[calert show];
}
Is it possible to hide the calling number? Please help me.
It is impossible:
1) You must be able to know what number you are calling, it is very important so that you avoid fees for surtaxed numbers, and apple won't let you do otherwise.
2) Even if you manage to hide the phone number, it would still appear on the bill from the user mobile operator.
Only workaround would be to call through a secure connexion to a SIP server (Without using voice call feature of the phone), but then it wouldn't transit through the phone app, and the usual voice plan of the user.
I think it is not possible.
The Call application only allow you to pass numbers to call and you do not have control on what to show as Title (Name OR Number) while calling using Call app of device.
But if you are calling to a Number which is in your device Contact then it will show Name of the person matching Number.
But it is not possible to show your desired Name while calling from your application.

orphaned UILocalNotification - confirmed

I have an app I am working on with allows the user to set and remove UILocalNotifications. In the course of developing this I have added and removed UILocalNotifications for testing and it seems to be working.
However I am seeing strange behavior where, after deleting my app from the device and running it again without setting any notifications, I will get a UILocalNotification. This notification was not set in this fresh install (checked through adding a breakpoint in my notification setup method).
Is it possible that I have an orphaned UILocalNotification from a previous install (yes, it seems highly unlikely to me too).
I've tried debugging this by setting the notification alertBody to something specific to each new install but this unique string doesn't get displayed in the alert. For example:
notif.alertBody = [NSString stringWithFormat:#"Alert for: %#", alertName];
Has anyone seen this sort of behavior before?
Update: Just confirmed orphaned UILocalNotifications: deleted the app from the device and ran the code below in my rootViewController on viewDidAppear. I get the following output in the Console:
2013-03-14 14:20:07.439 TestApp[16606:907] found alert: uigffhy
2013-03-14 14:20:07.444 TestApp[16606:907] found alert: uigffhy
Where this user was from some previous install. Ugh.
NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
for (UILocalNotification *notif in notificationArray) {
NSDictionary * info = notif.userInfo;
NSString * name = [info objectForKey:#"sequenceName"];
NSLog(#"found alert: %#", name);
}
Just detect if it's a fresh install (using NSUserDefaults) and do the following in applicationDidFinishLaunching:
[[UIApplication sharedApplication] cancelAllLocalNotifications];

Resources