How to use didUpdateToLocation to Xcode Touch Library project so i can write the plugin for GPS using in Unity3d.
first i write a native app in objective c for getting the gps location on my iphone it works fine as native xcode object c projects does.
now my next goal is to make a library or cocos touch static library refereces as link listed below:
http://blog.mediarain.com/2013/03/creating-ios-plugins-for-unity/
http://okita.com/Unity/2015/08/making-an-ios-plugin/
The Orignal Code is so easy and implementation is also easy
but for cocos touch static library .mm file there are some differences :
Orignal Implementation :
(void)viewDidLoad {
[super viewDidLoad];
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.delegate = self;
}
And my didToUpdateLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
self.lblLong.text = [NSString stringWithFormat:@"%f",manager.location.coordinate.latitude];
self.lblLat.text = [NSString stringWithFormat:@"%f",manager.location.coordinate.longitude];
}
This method is update automatically when recieved new location you have to write it in .m file.
Now i create a Cocos Static Touch Library Prject and make a .mm file which is basically in C not objective c So how to call these method
i try to copy and paste it but it does not work
[self.locationManager startUpdatingLocation];
This is for starting location services.
↧