notifications - Parse : [PFInstallation currentInstallation] returns null -



notifications - Parse : [PFInstallation currentInstallation] returns null -

i have been revolving around issue long time couldn't relevant solution this.i intended send force notification device within miles (miles decided user). utilize next code on click of button, working fine before came across pathetic problem.

if (setmiles == 0) { uialertview *alert = [[uialertview alloc]initwithtitle:@"broadcast alert" message:@"please select broadcast range" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; } else { pfinstallation *installation = [pfinstallation currentinstallation]; nslog(@"%@",installation); [pfgeopoint geopointforcurrentlocationinbackground:^(pfgeopoint *geopoint, nserror *error) { if (!error) { pfquery *userquery = [pfinstallation query]; [userquery wherekey:@"location" neargeopoint:geopoint withinmiles:setmiles]; nsstring *str_currentdevicetoken = [nsstring stringwithformat:@"%@",[installation objectforkey:@"devicetoken"]]; [userquery wherekey:@"devicetoken" notequalto:str_currentdevicetoken]; nslog(@"%@",userquery); nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys: notiftextview.text, @"alert", @"1", @"badge", @"", @"sound", nil]; pfpush *push = [[pfpush alloc] init]; [push setquery:userquery]; [push setdata:data]; [push sendpushinbackground]; } else { nslog(@"%@", error); return; } }]; [self.navigationcontroller poptoviewcontroller:[self.navigationcontroller.viewcontrollers objectatindex:1] animated:yes]; }

and in appdelegate file :

-(void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken { [pfgeopoint geopointforcurrentlocationinbackground:^(pfgeopoint *geopoint, nserror *error) { if (!error) { nslog(@"user @ %f, %f", geopoint.latitude, geopoint.longitude); pfinstallation *currentinstallation = [pfinstallation currentinstallation]; [currentinstallation setdevicetokenfromdata:devicetoken]; currentinstallation[@"location"] = geopoint; [currentinstallation saveinbackground]; } else { nslog(@"%@", error); return; } }]; } - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [pfpush handlepush:userinfo]; nslog(@"userinfo= %@",userinfo); }

this when log installation object :

<pfinstallation:toe395mvke:(null)> { appidentifier = "myaddid"; appname = myappname; appversion = "1.0"; badge = 0; devicetoken = mydevicetoken; devicetype = ios; installationid = "myinstallationid"; location = "<pfgeopoint: 0x17d660>"; parseversion = "1.2.19"; timezone = "asia/kolkata"; "user_type" = main; }

ps : no longer able receive force notification's.

i not sure why happening used work fine earlier.any help appreciated deeply.

thank you.

notifications parse.com push-notification apple-push-notifications ios7.1

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -