objective c - ios simulator black screen with status bar -
i new objective-c , i'm making first app, single-view app. when run program ,the fullscreen ad supposed appear (i'm using revmob) appears. however, when exit ad black screen blue status bar @ top.
i have tried many things, such setting main view controller initial view controller, restarting computer, changing/removing debugger, resetting ios simulator, etc.
my xcode version 4.6 , os mac osx 10.8.4
i don't want delete xcode , don't want remove ads because source of income.
here code:
appdelegate.m
@implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions: (nsdictionary *)launchoptions { [revmobads startsessionwithappid:@"myappid"]; self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease]; [self.window makekeyandvisible]; return yes; } - (void)applicationwillresignactive:(uiapplication *)application { // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state. // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. } - (void)applicationdidenterbackground:(uiapplication *)application { // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state in case terminated later. // if application supports background execution, method called instead of applicationwillterminate: when user quits. } - (void)applicationwillenterforeground:(uiapplication *)application { // called part of transition background inactive state; here can undo many of changes made on entering background. } - (void)applicationdidbecomeactive:(uiapplication *)application { // restart tasks paused (or not yet started) while application inactive. if application in background, optionally refresh user interface. revmobfullscreen *ad = [[revmobads session] fullscreen]; [ad loadwithsuccesshandler:^(revmobfullscreen *fs) { [fs showad]; nslog(@"ad loaded"); } andloadfailhandler:^(revmobfullscreen *fs, nserror *error) { nslog(@"ad error: %@",error); } onclickhandler:^{ nslog(@"ad clicked"); } onclosehandler:^{ nslog(@"ad closed"); }]; } - (void)applicationwillterminate:(uiapplication *)application { // called when application terminate. save data if appropriate. see applicationdidenterbackground:. } - (void)dealloc { [_window release]; [super dealloc]; } @end
appdelegate.h:
#import <uikit/uikit.h> #import "viewcontroller.h" @interface appdelegate : uiresponder <uiapplicationdelegate> @property (strong, nonatomic)uiwindow *window; @end
there nothing wrong ad code. seems (not) happening app has no content. suspect haven't set rootviewcontroller (initial view controller) app correctly.
this need do:
get rid of of
appad code , make app works. has correctly show initial view controller. make new project in xcode using single view application template.add app code per this example. invoke code initial view controller via button.
once working, can add code
- (void)applicationdidbecomeactive:(uiapplication *)application
per question. when dismiss advert, should see initial view controller.
Comments
Post a Comment