응용 프로그램이 종료되거나 백그라운드에서 10 분마다 배경에서 위치를 보내려고합니다.응용 프로그램이 종료 될 때 백그라운드 위치를 보내는 방법
:
@interface ViewController : UIViewController<CLLocationManagerDelegate>
프레임 워크를 포함 : 네 다음 날 감사
응용 프로그램이 종료되거나 백그라운드에서 10 분마다 배경에서 위치를 보내려고합니다.응용 프로그램이 종료 될 때 백그라운드 위치를 보내는 방법
:
@interface ViewController : UIViewController<CLLocationManagerDelegate>
프레임 워크를 포함 : 네 다음 날 감사
을 제안 당신이 헤더에 다음을 추가해야합니다 경우 그것을 사용하는 방법을 .. 이 가능한 코드를 제공하십시오 네비게이터에서 프로젝트를 클릭하십시오.
은 "라이브러리와 링크 바이너리"
프로젝트에 Corelocation 추가 아래에있는 플러스 버튼을 클릭합니다.
오기 헤더 파일는 :
#import <CoreLocation/CoreLocation.h>
는 CLLocationManager 선언
CLLocationManager *locationManager;
ViewController.m을
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"today monday");
myTimer = [NSTimer scheduledTimerWithTimeInterval: 60.0 target: self
selector: @selector(first:) userInfo: nil repeats: YES];
}
-(void)first:(id)sender
{
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
NSLog(@"called");
[self.view setBackgroundColor:[UIColor greenColor]];
CLLocationCoordinate2D coordinate;
NSString * currentLat = [NSString stringWithFormat:@"%f",coordinate.latitude];
NSString * currentLong = [NSString stringWithFormat:@"%f",coordinate.longitude];
NSLog(@"latitude %@",currentLat);
NSLog(@"longitude %@",currentLong);
}
NSTimer 적 첫번째 방법 1 마일 호출 할 수 n
시도해보십시오. 도움을 청하십시오.
이 코드는 응용 프로그램이 실행될 때 실행됩니다 배경 또는 전경 .. 응용 프로그램이 종료되거나 상태가 종료되면 위치를 보내려고합니다. –
@ShashankPrinceMishra currentLat 및 currentLong 값이 서버로 전달됩니다. –
위도와 경도를 보내시겠습니까? 또는? –
ya 위도와 경도 서버에 –
도와주세요 어떻게 할 수 있습니다 –