0

Is there a way to present a alert like the alert presented by twitter SDK if no account is signed-in.

I want to display that type of alert if user has disabled Settings->Notification Center for my app.

Just want to present the alert, mentioned twitter as ref. Its not about twitter. enter image description here

NOTE: I don't want to display / use social media, its for reference, question is can we display a custom alert which can navigate the user to settings app of iOS.

Zubair
  • 5,833
  • 3
  • 27
  • 49
  • 1
    it is only available ios 5. after implement social framework it doesn't come. if you want you can do customize – codercat Feb 12 '14 at 09:03
  • @iDev, thanks but as I mentioned its only for ref. I want to display that type of alert if user has disabled Settings->Notification Center for my app. – Zubair Feb 12 '14 at 09:08

3 Answers3

2

There is no way to know the status of the switch in Notification Center > Your app. The only thing you can access is what type of notifications he will get ([[UIApplication sharedApplication] enabledRemoteNotificationTypes];).

rdurand
  • 7,342
  • 3
  • 39
  • 72
1

You can know notification setting of your app and can show alert when it is disable as below

UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (!(types & UIRemoteNotificationTypeAlert)) {
UIAlertView *al = [[UIAlertView alloc] initWithTitle:@"TITLE" message:@"YOUR MESSAGE" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:@"Settings",nil];
    [al show];
    [al release];

}

For more reference, you may check Determine on iPhone if user has enabled push notifications

Community
  • 1
  • 1
Rahul Patel
  • 5,858
  • 6
  • 46
  • 72
0

The only settings you can access are your app's settings, which can be within your app or in Settings app. Your app's settings are the ones you set/get with [NSUserDefaults standardUserDefaults]. However for your case you could schedule a notification which fires after one second, and see if you get called from - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification. Here is an example code.

-(void) createLocalNofication{
UILocalNotification *local = [[UILocalNotification alloc] init];
local.fireDate = [NSDate dateWithTimeIntervalSinceNow:1.0f];

local.alertBody = @"Some Alert Body";
local.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:local];


}
- (void)application:(UIApplication *)application didReceiveLocalNotification:   (UILocalNotification *)notification {

//Here you can set some flag
}

To gain more insight on the topic, you can check out this apple documentation link.

HussoM
  • 1,272
  • 13
  • 7