AppDelegate never being called on iphone/ipad
I am developing an app that runs on both ipad/iphone, so for ipad
I am using a view controller in mainWindow_ipad.xib
and then I am loading a new view using navigation vc, but I cant access my appDelegate
method. The app directly starts and loads the newView which I am loading
- (BOOL开发者_C百科)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { }
How can I ensure this method is called? I am loading mainWindow_ipad.xib
from info.plist
Update
this is my .m file
@implementation Ihope_test_sqlAppDelegate_iPad
@dynamic aNav;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
NSLog(@"IPAD");// but i cant find this log output
}
this is my .h file
#import "Ihope_test_sqlAppDelegate.h"
@class RootView;
@interface Ihope_test_sqlAppDelegate_iPad : Ihope_test_sqlAppDelegate
{
IBOutlet UINavigationController *aNav;
}
//@property (nonatomic, retain) UITextField *usernameField;
//@property (nonatomic, retain) UITextField *passwordField;
@property (nonatomic, retain) IBOutlet UINavigationController *aNav;
-(IBAction)removeKeyboard;
@end
Check that the class of the app delegate in mainWindow_ipad.xib is of the right class. You need to make sure that the MainWindow nib file for iPad has an App Delegate that is of the Ihope_test_sqlAppDelegate_iPad
class rather than Ihope_test_sqlAppDelegate
.
精彩评论