iPhone Application Developer – iPhone Developer Labs – iPhone Application Development

iPhone application developer resource – application development, updates & news for iphone developers

Posts Tagged ‘iPhone SDK Help’

Good News for App Developers : Multi-Tasking Added to OS 4.0

March 15th, 2010 by Saptarshi Roy Chaudhury No comments »

Multitasking has been one of the most requested features for the iPhone and it looks like it’s finally coming to the device. Apple is working to reveal the next Firmware Upgrade iPhone OS 4.0 which would include this feature, reports AppleInsider from trusted sources. The inability to multi-task has always topped the list of complaints on iPhone and now Apple is finally going to tackle the issue of running third party apps in background. This means iPhone user’s will now be able to do the “full on multi-tasking” .

Today’s iPhone’s 3.x.x software is a fully preemptive multitasking operating system but it artificially restricts apps (other than specific ones bundled with the system by Apple) from running in the background. Apple has always cribbed on poor battery life as the reason to not enable this feature. With the iPhone barely running for 6 hours under heavy use, according to Apple, running apps in the background would bring the battery life down even more.

Since Apple first introduced the ability to run third party applications on the Apple iPhone 2.0 controversies have been brewing with the multi-tasking issue, often reported as a technical flaw. The phone can run SMS, email, iPod, voice recorder and certain other bundled applications in background while another application is being used, but in case of a third party app, it is designed such that the app is shut down when the user tries to go to the home screen or accept an incoming call .

Jailbreaking your iphone was a common way to launch and run multiple apps at the same time, however by jail breaking the iPhone Security Model is compromised. This also opens doors to malware and piracy, which were handled previously by the default security system. With this multi tasking feature being a part of iPhone OS 4.0, it would no longer be required to jailbreak your iPhone for multi tasking.

Tags: iPhone App Development, iphone developers, iPhone OS, iPhone SDK Help

Utility for iPhone app developers: iSimulate

November 4th, 2009 by Rama Krishna 1 comment »

Tired of having to install your application on a device for every little change that you make in your code? No!! You test it on the iPhone Simulator!!
What if the application uses GPS and Accelerometer? You cannot test it on the iPhone Simulator.

Here comes iSimulate from vimov to your rescue. People at vimov have created a really useful utility for developers to test their applications which employ GPS and Accelerometer on the iPhone Simulator. Lots of time saved between installs right!!

iSimulate is an application which you download and install on your device to send accelerometer and GPS details to the app running on the iPhone Simulator. The app must of course embed the iSimulate library to be able to receive those details. All it takes to install the iSimulate app on your device, embed the library in your application and start using it is just around 5 minutes.

The newer releases of iSimulate even support video streaming. You can actually see the game or app on your iPhone or iPodTouch even though it’s running on the iPhone Simulator. This enables you to provide very accurate touches to the Simulator. This is a giant leap forward from it’s first days where you had screen filled with Accelerometer graph to simulate touches!!

iSimulate really makes testing your apps easy and quick. Go get your apps on to AppStore that much quicker!!

Tags: iPhone App Developers, iPhone Application Development, iPhone SDK Help, iphone simulator

Custom URL schemes and Launching other applications — Best Practices for iPhone OS 3.0

August 24th, 2009 by Rama Krishna 1 comment »

How to open other applications like phone dialer, SMS, Safari, Google Maps, iTunes or AppStore or any other iPhone application?

“openURL” is the API to use to achieve any of the above and many more.
If you need to let your application users quickly dial APPLE from within your app, just include the following line

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:8006927753"]];

Similarly, you could initiate SMS application by using openURL with “sms: “, but unfortunately you cannot fill in the SMS content as Apple does not yet support it.
There are many more things you could do with this API like launching Google Maps, Safari with any website like you want or even the AppStore links to your apps which you want the users to buy.

Checking support for URLs of other applications
Until the release of iPhone OS 3.0 it was not possible to find if there are any applications installed on the device which handle the URL scheme you are about to use. But now it is possible through the following API

- (BOOL)canOpenURL:(NSURL*)url

Call the above API before using “openURL” to make sure your call will “certainly” be handled by a registered application. If you were developing an iphone app which lets a phone call be made from within it, do the following

// this will fail if the device is an iPod
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:111"]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:111"]];
}
else
{
// show an Alert here indicating that the call can’t be completed
}

Apart from using “canOpenURL”, do check the return value from “openURL” too and take appropriate action.

You should also use “canOpenURL” to find out if any features (like calling a number and SMS) that are not accessible on iPod should be disabled or hidden. Showing “phone” icons and letting them be clicked in your application on an iPod is a sure shot way to get your application rejected for uploading to AppStore.

Registering and handling custom URL schemes
If you are developing a great tool and can be used by other applications, you can register custom URL schemes and implement them. To create custom URL schemes just add them to your application’s “info.plist” file.

  • To the root element of your application’s “info.plist” file, add a row with key named “URL types”.
  • Expand it to find “item1″ in it, expand it and edit the value for key “URL identifier” to look something like “com.yourcompany.yoururlscheme”
  • Add another row to “item1″ with key “URL Schemes”. Type in the first few characters of your URL scheme.
    For an example, if you wish to use url formats like abc://part1/part2, just enter “abc” for URL Schemes

Once you have created and registered your own URL formats/schemes, you can handle incoming URL requests by implementing the following UIApplicationDelegate method

- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url

Before parsing and/or handling the URL, make sure it is in the right format and follows all rules of your URL scheme.

The above method was the only place where you can handle incoming URLs until iPhone OS 3.0 arrived. For iPhone OS 3.0 and above, the preferred place to handle incoming URLs is

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

This method should return whatever “handleOpenURL” API would have returned if it were implemented. If you implement the above delegate method of UIApplication, IPhone OS will not invoke the following methods

- (void)applicationDidFinishLaunching:(UIApplication*)application
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url

Tags: Best Practices for iPhone OS 3.0, iPhone App Developers, iPhone app Developers help, iPhone App Development, iPhone Custom URL schemes, iPhone OS 3.0, iPhone SDK Help
© 2011 iPhone Application Developer – iPhone Developer Labs – iPhone Application Development
iPhone Development Labs, iPhone Development Help, iPhone Development Tips
Back to Top