iPhone web app auto refresh - iphone

I'm making an iPhone app where all the data is online so its really a web app and the app listed on the app store is the portal to get onto it.
I would like to know how can I make it that every time the app is opened the page is refreshed and it take the user back to the homepage, and auto refresh say after 10mins.

try:
[NSTimer scheduledTimerWithTimeInterval:600 target:self selector:#selector(refreshWebView) userInfo:nil repeats:YES];
-(void)refreshWebView{
//refresh your webView here..
}
note: untested

Related

Check a condition in the background every x minites, and if true, send notification

I've been looking for the solutions for several hours. I know how to use local notification. What I found is that local notification can be shown repeatedly, but the notification body and icon badge number should always be the same. What I want to do is: check a condition repeatedly even if the app is not running, if the condition is true, put a notification to the notification center, show a number to the app's icon badge. The number to show is got from database.
Does anybody know how to handle this? Any help will be appreciated.
Well you can do this, use nstimer and then run it every minutes after that inside timer selector write your condition to check after that on the basis of that post notification.
[NSTimer scheduledTimerWithTimeInterval:1
target:self select:#selector(sendnotification:) userInfo:nil repeats:YES];
-(void)sendnotification:(Nstimer*)timer
{
//post notification here
}

multitasking in ios 4 later for notifications

i want to run one of my services in the background even my app is in foreground or background states,if i get any data from that service i want to show that one as a notification to the user. how can i proceed .
as my reserach gives me an idea to follow multi taking in iphone .
or shall i use any timer so that the method calls for particular time interval for every time
NSTimer *timer = [NSTimer timerWithTimeInterval:1 target:self selector:#selector(notification) userInfo:nil repeats:YES];
[timer fire];
-(void)notification
{
//shall i write all of my services here
}
or shall i create any new threads like
[self performSelectorInBackground:#selector(notification) withObject:Nil];
in AppDelegate file .
or shall i need to follow any other thing plz guide me thank you.
Generally, you should consider using push notifications sent by the server to show notifications to the user when something changes. This is preferable to running in the background since it is better for system performance & battery life.

Can I have set the time for Launch image(app Start up)..? I mean,for 5 seconds

I have added launch image in my application in info.plist. So,may I know is it possible to set the time for launching application for 5 seconds.Thanks
You can definitely do that, but you shouldn't. The user will be staring at an useless splash screen just for nothing.
In your app delegate's didFinishLaunching method, do:
sleep(5);
In your App delegate class, in the didFinishLaunchingWithOptions method.
[NSThread sleepForTimeInterval:5.0];
This will make your app waiting for 5 sec.
Yes. You can set time for launch image. Below is code. It may help you.
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:#selector(onLaunchExpire) userInfo:nil repeats:NO];
Use this and let me know for more details..

How to set the Timer in iphone

I just want to set the timer for the recorded voice. So, that it comes like an alarm after that time.(just like notifications).
Is that possible..
Any help will be greatly appreciated...
Thanks in Advance
Try reading NSTimer Class in developer documentation or you can refer this link
You might want to look at local notifications and NSTimer. Note that NSTimer doesn't work when the app is in the background.
Here is an example with NSTimer:
- (void)bar {
[NSTimer scheduledTimerWithTimeInterval:200.0f
target:self
selector:#selector(foo:)
userInfo:nil
repeats:YES];
}
- (void)foo:(NSTimer *)timer {
// Show alert or play recorded sound…
}
I'm afraid you can't play the recorded sound with local notifications, only when the app is in the foreground.

Doing some downloading without blocking you app

I'm working on my first app that's doing a few different web connections at once.
My first screen is my Menu.
And at the bottom of viewDidLoad of MenuViewController i call a method that gets and parses a .xml file that is located on my webserver.
Also at the bottom of viewDidLoad i do
FootballScores = [[FootBallScores alloc] init];
and FootballScores makes a connection to a html page which it loads into a string and then parses out data.
Now since both of these are getting called at the bottom of viewDidLoad of the class thats is responsible for the main menu(first screen in the app) it means the app is kinda slow to load.
What is the right way to do the above? Should i remove the 2 pieces of code from my viewDidLoad and replace with maybe
dataGetterOne = [NSTimer scheduledTimerWithTimeInterval:1.000 target:self
selector:#selector(xmlParser) userInfo:nil repeats:NO];
dataGetterTwo = [NSTimer scheduledTimerWithTimeInterval:2.000 target:self
selector:#selector(htmlParser) userInfo:nil repeats:NO];
This would mean that the methods get called later on and the viewDidLoad gets to finish before the i try get the data from the web servers.
Making 2 connections to we bservers a second apart to quick? Can the iphone handle having 2 connections open at once?
I'm really unsure of anything bad/dangerous I am doing in regards to connections.
Many Thanks
-Code
Try using ASIHTTPRequest. It's easy to use and lets you make asynchronous requests that don't block your app with few lines of code.
Hope this helps,
ender
Also, I wrote a brief tutorial on writing your own XML/JSON data-parsing app. I hope it may be helpful in thinking about how to structure such an app.