Application Badge - iphone

Hi guy it's possible put in the application Badge some letter?
Something like ON OFF?
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
Work but it's a number
in the Sadun's book (my last day bibble) i see
[UIApplication sharedApplication] setapplicationBadge:#"ON";
But not work, any idea?

setApplicationBadge: isn't in the UIApplication API documentation. My guess is that the method used to exist but was removed.

Related

How to clear all the notifications from notification bar in iphone

I have to clear all the Remote/Local notifications from the notification bar when the user logs out from the app without clearing by his/her own. I'm using this code to clear the notifications but it isn't working for me this is my code:
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
It seems your code is correct. Still you can try this.
[UIApplication sharedApplication].applicationIconBadgeNumber = -1;
See this.

Make a Call from UITableViewCell

I stuck with a problem.
In my tableView I got a cell with a phone number. I would like to click on the phone number and make a call.
I implemented the following in didSelectRowAtIndexPath:
NSString *cifra=#"tel://123456789";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:cifra]];
NSLog(#"after call %#",cifra);
Unfortunatly it doesnt do anything. In my log it shows me my "after call ... " but it is not calling. No error, no log, no action :(
It works for me with opening a website or googleMaps, but not for calling.
Is there anything i can do?
Maybe a it is simple answer, but i really dont know what to do. Is there a different way to make a call?
I am using the iPhone Simulator. Is this the problem? But it should do a thing, shouldn't it? :)
Thanks for your help!
You can't make calls from the Simulator.
If you want to test making a phone call, run the app on your device, then press the cell to make a phone call on your actual device.
You can simulate the in-call status bar, but there is nothing actually happening when it comes to actual phone calls.
Hardware > Toggle In-Call Status Bar
Note that using [[UIApplication sharedApplication] openURL:SOMEPHONENUMBER]; does not trigger this event.
Tried this code to make a call
NSString *prefix = (#"tel://(972)818-32432");
UIApplication *app = [UIApplication sharedApplication];
NSString *dialThis = [NSString stringWithFormat:#"%#", prefix];
NSURL *url = [NSURL URLWithString:dialThis];
[app openURL:url];
On top of the answers mentioning you can't make calls from the simulator, cifra should be #"tel:123456789", the double slashes aren't needed.

badge number count increament

I have implemented the local notification concept, it is working properly but there is a problem in badge number it is not increamenting automatically as notifications occurs. I have got a link where solution for this problem is given but don't know how to use it in app delegate. Following is the link... If someone know how to auto increament the badge number ,please provide me some solution.
https://github.com/csheldrick/UILocalNotification
Thanku very much.
When you create your local notification then before registring it with the system add this line of code.
localNotif.applicationIconBadgeNumber = [UIApplication sharedApplication].applicationIconBadgeNumber+ 1;
and then you register you notification with the system
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
localNotif is object of UILocalNotification
Hope this helps
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[UIApplication sharedApplication].applicationIconBadgeNumber=application.applicationIconBadgeNumber+1;
}
i hope it will help ful to you

Restarting iPhone application after [UIApplication sharedApplication] openURL

As title says I'd like to know how to restart my iPhone app after doing this:
[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:#"tel://0123456789"]]
It seems pretty simple as I saw many topics also talking about restoring the very state of the application when openURL is called, but I can't find how to simply restart the app when the calling is finished.
Is it supposed to be the default behavior? As for me, the iPhone opens Favorites after call is finished, I don't know why.
You can't. Starting an app is solely user's responsibility - which I consider a good thing.
check the discussion here: https://devforums.apple.com/message/128046#128046
create a UIWebView to load the phone url like this:
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[webview loadRequest:[NSURLRequest requestWithURL:url]];
just use
[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:#"telprompt://0123456789"]]
It will return to the app after call finished
You can't restart an app after a phone call, as your app has terminated and your code is no longer being run.
If you want to restart after the user visits a webpage, you can put a link with a custom scheme in that webpage, and register it with your app. The user can then tap the link to open your app again.

-setStatusBarHidden:animated: is deprecated

At the start of my app, the status bar is hidden, due to the Info.plist setting called Status bar is initially hidden. Later on, I want to show the status bar using:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
but I get a warning saying that the function is deprecated. Does anybody know what the new function is?
setStatusBarHidden:withAnimation: is the new method, which takes a UIStatusBarAnimation instead of a BOOL, so you can choose what animation is used to hide the status bar.
It is:
- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation
See the UIApplication class reference for more info.
If you are trying to write code for both iOS 3.x and iOS 4.x, you are going to run into a further issue that the new method is not available in the old iOS. See this question for further info.
Add this to your AppDelegate.m
[UIApplication sharedApplication].statusBarHidden = YES;