Generate a Simulator Build
In order to generate a simulator build you will:- Find the folder containing your xcode project.
- Open a terminal and run a couple of commands to generate the build.
- Compress the simulator build into a zip file.
AppDelegate *appDelegate = (AppDelegate*) [[UIApplication sharedApplication] delegate];
UIWindow *mainWindow = [[UIApplication sharedApplication] windows].lastObject;
// or
UIWindow *mainWindow = [(AppDelegate*) [[UIApplication sharedApplication] delegate] window];
// If UINavigationController is on the rootViewController
UINavigationController *navController = (UINavigationController*) [[appDelegate window] rootViewController];
//===================== AppDelegate.m ====================
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UIStoryboard *mainStoryboard = nil;
if (IS_IPHONE_5) {
mainStoryboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone5" bundle:nil];
}
else {
mainStoryboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone4" bundle:nil];
}
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [mainStoryboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[NSTimer scheduledTimerWithTimeInterval:1.0 // time in seconds
target:self
selector:@selector(timerFired)
userInfo:nil
repeats:YES];
}
- (void)timerFired{
NSLog(@"Hello");
}