2011-04-23 42 views
0

什麼是適用於Android的Java版iPhone中的等效Objective-C片段。Objective-C的Android GPS轉換

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    locationManager = [[CLLocationManager alloc]init]; 
    [locationManager setDelegate:self]; 

    [locationManager setDistanceFilter:kCLDistanceFilterNone]; 
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; 

    [locationManager startUpdatingLocation]; 

    [self.window makeKeyAndVisible]; 
    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); 
} 
+2

在stackoverflow我們很高興提供的關鍵解決方案,而不是轉換的代碼片段,可以直接複製。 :) – necixy 2011-04-23 19:12:48

回答