I'm trying to get started with Phonegap.
I have added some code to applicationDidFinishLaunching but this doesn't seem to be getting called.
I've added breakpoints (log, continue) to eac开发者_运维问答h of the init and applicationDidFinishLaunching methods. This confirms that the latter indeed isn't getting invoked.
Xcode, Objective-C and Phonegap are all foreign to me and so Im a bit lost as to how to resolve this.
thanks
EDIT: I've just tried creating a brand new blank unmodified phonegap project, and the same thing happens. init breakpoint fires, but applicationDidFinishLaunching does not.
The reason this is occurring is because the Phonegap Xcode template is using the wrong UIApplication method for the app load event. As of iOS 4.0 and higher, Apple recommends to use didFinishLaunchingWithOptions instead of applicationDidFinishLaunching because the former contains option parameters that lets the developer know how the app was called. Since iOS 4.0 and higher supports background processing, the app may have been launched from an Apple Push Notification and needs to be handled appropriately.
So to solve this problem, you need to remove the code in your AppDelegate.m file that references applicationDidFinishLaunching and include the following code instead:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Add custom code here
return [ super application:application didFinishLaunchingWithOptions:launchOptions ];
}
For some reason the Phonegap 0.9.3 library has the correct implementation of didFinishLaunchingWithOptions in the PhoneGapDelegate.m, but the main XCode template still references applicationDidFinishLaunching, which will never get called.
I am new to iphone development. But i have done one small app using phonegap framework.
Yes When we use phonegap framework our Project's applicationDidFinishLaunching does not work and other methods like webViewDidFinishLoad and webViewDidStartLoad in app delegate also not work..
Instead of this applicationDidFinishLaunchinWithOptions of PhoneGapLib.xcodeproj which is included in our project of phonegap gets excute.
Try to write NSLog(); there. U will get output on consol..
精彩评论