Push and map modified in iOS8

Source: Internet
Author: User

iOS8 before you sign up for notifications is

       [Application Registerforremotenotificationtypes:uiremotenotificationtypealert| uiremotenotificationtypesound| Uiremotenotificationtypebadge];

iOS8 Register So write

    Uiusernotificationsettings *setting = [Uiusernotificationsettings settingsfortypes:uiusernotificationtypealert| uiusernotificationtypebadge| Uiusernotificationtypesound Categories:nil];    [Application registerusernotificationsettings:setting];

About Cllocationmanager

    Locationmanager = [[Cllocationmanager alloc] init];    Locationmanager. delegate = self ;    [Locationmanager startupdatinglocation];

iOS8 added after the [locationmanager requestalwaysauthorization];

The rest of the content doesn't change. Add two fields to the Info.plist nslocationwheninuseusagedescription and Nslocationalwaysusagedescription

The callback method after positioning is as follows

-(void) Locationmanager: (cllocationmanager *) Manager didupdatelocations: (nsarray *) Locations

In this method, you can get the latitude and longitude control, the location can be geo-coded to get the current position information

Clgeocoder *geocoder =[[Clgeocoder alloc] init]; [Geocoder reversegeocodelocation:newlocation Completionhandler:^ (Nsarray *placemarks, Nserror *error) {         for(Clplacemark *placeinchplacemarks) {NSLog (@"name,%@", place.name);//location[manager Stopupdatinglocation]; }    }];//about this clplacemark can point in to see/*Including street information can also get @property (nonatomic, readonly, copy) nsdictionary *addressdictionary;//address Dictionary Properties@property (nonatomic, readonly, copy) NSString *name; eg. Apple Inc. @property (nonatomic, readonly, copy) NSString *thoroughfare; Street address, eg. 1 Infinite loop@property (nonatomic, readonly, copy) NSString *subthoroughfare; eg. 1@property (nonatomic, readonly, copy) NSString *locality; City, eg. Cupertino@property (nonatomic, readonly, copy) NSString *sublocality; Neighborhood, common name, eg. Mission District@property (nonatomic, readonly, copy) NSString *administrativearea; State, eg. Ca@property (nonatomic, readonly, copy) NSString *subadministrativearea; county, eg. Santa Clara@property (nonatomic, readonly, copy) NSString *postalcode; Zip code, eg. 95014@property (nonatomic, readonly, copy) NSString *isocountrycode; eg. Us@property (nonatomic, readonly, copy) NSString *country; eg. States@property (nonatomic, readonly, copy) NSstring *inlandwater; eg. Lake Tahoe@property (nonatomic, readonly, copy) NSString *ocean; eg. Pacific Ocean@property (nonatomic, readonly, copy) Nsarray *areasofinterest; eg. Golden Gate Park*/

Push and map modified in iOS8

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.