Created
June 7, 2012 13:17
-
-
Save tatsuro-ueda/2888758 to your computer and use it in GitHub Desktop.
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
#import <UIKit/UIKit.h> | |
#import <CoreLocation/CoreLocation.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
{ | |
CLLocationManager *locationManager; | |
} | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// Override point for customization after application launch. | |
// ロケーションマネージャーを生成する | |
locationManager = [[CLLocationManager alloc] init]; | |
// ロケーションマネージャーを設定する | |
[locationManager setDelegate:self]; | |
[locationManager setDistanceFilter:kCLDistanceFilterNone]; | |
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; | |
// 位置情報の検出をすぐに開始する | |
[locationManager startUpdatingLocation]; | |
return YES; | |
} | |
- (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); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment