Created
September 26, 2013 21:30
-
-
Save andrewschreiber/6720858 to your computer and use it in GitHub Desktop.
Designated initializer not called
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// Whereami | |
// | |
// Created by Andrew Schreiber on 9/25/13. | |
// Copyright (c) 2013 Andrew Schreiber. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import "WhereAmIAppDelegate.h" | |
int main(int argc, char * argv[]) | |
{ | |
@autoreleasepool { | |
NSLog(@"Test main"); //<-- works | |
return UIApplicationMain(argc, argv, nil, NSStringFromClass([WhereAmIAppDelegate class])); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WhereAmIAppDelegate.h | |
// Whereami | |
// | |
// Created by Andrew Schreiber on 9/25/13. | |
// Copyright (c) 2013 Andrew Schreiber. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface WhereAmIAppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WhereAmIAppDelegate.m | |
// Whereami | |
// | |
// Created by Andrew Schreiber on 9/25/13. | |
// Copyright (c) 2013 Andrew Schreiber. All rights reserved. | |
// | |
#import "WhereAmIAppDelegate.h" | |
@implementation WhereAmIAppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// Override point for customization after application launch. | |
return YES; | |
} | |
- (void)applicationWillResignActive:(UIApplication *)application | |
{ | |
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | |
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | |
} | |
- (void)applicationDidEnterBackground:(UIApplication *)application | |
{ | |
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | |
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | |
} | |
- (void)applicationWillEnterForeground:(UIApplication *)application | |
{ | |
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | |
} | |
- (void)applicationDidBecomeActive:(UIApplication *)application | |
{ | |
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | |
} | |
- (void)applicationWillTerminate:(UIApplication *)application | |
{ | |
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WhereAmIViewController.h | |
// Whereami | |
// | |
// Created by Andrew Schreiber on 9/25/13. | |
// Copyright (c) 2013 Andrew Schreiber. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import <CoreLocation/CoreLocation.h> | |
@interface WhereAmIViewController : UIViewController <CLLocationManagerDelegate> | |
{ | |
CLLocationManager *locationManager; | |
} | |
//@property (nonatomic)CLLocationManager *locationManager; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WhereAmIViewController.m | |
// Whereami | |
// | |
// Created by Andrew Schreiber on 9/25/13. | |
// Copyright (c) 2013 Andrew Schreiber. All rights reserved. | |
// | |
#import "WhereAmIViewController.h" | |
@interface WhereAmIViewController () | |
@end | |
@implementation WhereAmIViewController | |
- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
NSLog(@"Test1"); // <- DOES NOT SHOW ON LOG | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if(self) | |
{ | |
locationManager = [[CLLocationManager alloc]init]; | |
[locationManager setDelegate:self]; | |
//We want it to be as accurate as possible | |
//regardless of how much time/power it takes | |
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; | |
//Tell our manager to start looking for its location immediately | |
[locationManager startUpdatingLocation]; | |
NSLog(@"Test2"); | |
} | |
return self; | |
} | |
- (void) locationManager:(CLLocationManager *) manager | |
didUpdateToLocation:(CLLocation *)newLocation | |
fromLocation:(CLLocation *)oldLocation | |
{ | |
NSLog(@"%@", newLocation); | |
} | |
- (void)locationManager:(CLLocationManager *)manager | |
didFailWithError:(NSError *)error | |
{ | |
NSLog(@"Could not find location: %@ error",error); | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment