1. Positioning positioning is positioning, map is a map, in iOS cllocation is specifically responsible for locating or acquiring location information, and Mapkit is specifically responsible for the map display
Location Manager (Cllocationmanager): responsible for acquiring and monitoring user location changes
[note] The location manager must be written as a property, not a property out of the stack.
_manager = [[Cllocationmanager alloc] init];
Set up the Location Manager Agent <CLLocationManagerDelegate>
_manager.delegate = self;
Setting the minimum update location
_manager.distancefilter = 50.0f; Unit is "M"
Set positioning accuracy, the higher the accuracy, the more power
_manager.desiredaccuracy = Kcllocationaccuracybest;
[Note:] Apple has modified the location license agreement in IOS8, which means that your original app may not be able to be located on IOS8. The best way to do this is to call IOS8 's location authorization API to get the user's authorization when the app is launched, so don't make any changes elsewhere, as follows
[_manager requestalwaysauthorization];
[_manager requestwheninuseauthorization];
[Note:] also need in the plist file inside the Nslocationalwaysusagedescription,nslocationwheninusedescription two attributes to add, value can be empty;
Let the location manager take effect and start updating location changes
[_manager startupdatinglocation];
2. Modification of the message push API
Commonly used third-party push servers in iOS are Aurora and homing pigeons; This introduction homing pigeon server
It can be seen from:
1. First in your app registration notice, registration notice when the difference is before and after iOS8, the difference is as follows
[note] if your system is iOS8 or later
if ([[Uidevice currentdevice].systemversion Floatvalue] >= 8.0) {
Set the representation of user notifications
[[UIApplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsForTypes :(Uiusernotificationtypealert | Uiusernotificationtypebadge | Uiusernotificationtypesound) Categories:nil];
Sign up for a remote notification request device token
[[UIApplication sharedapplication] registerforremotenotifications];
} else {
//[note]Register a remote notification, this remote notification, with text, corner label, sound
[[UIApplication Sharedapplication] registerforremotenotificationtypes: (Uiremotenotificationtypealert | Uiremotenotificationtypebadge | Uiremotenotificationtypesound)];
}
//Registered pigeon service only after registering this service, after the data will be sent to the carrier Pigeon server, only after registration, the carrier pigeon server can send messages to this app
+ (void) startApp: (uint32_t) appId AppKey: (NSString *) AppKey;
Parameter description:
Access ID: The Access ID that you get when you register your app with xg.qq.com.
Access key: Access key that you get when you register your app with xg.qq.com.
For example: [Xgpush startapp:1234567 appkey:@ "IF3W91AV58NC"];
2. Receive the device token returned to us by the APNS server
-(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) devicetoken{
Register this device identifier with the carrier pigeon
You have this real machine in the device list of the carrier pigeon after registration.
NSString *token = [Xgpush Registerdevice:devicetoken];
NSLog (@ "token:%@", token);
}
3. The application sends device token to the push server program.
4. The service-side program sends messages to the APNS service.
5. The APNs service sends the message to the iphone app.
Changes to the location and message push API after iOS8