我使用Parse來發送和接收推送通知。我已經仔細地跟隨了教程併成功實施了它。 現在我需要在用戶選擇的一定範圍內向用戶發送通知。使用Parse在特定里程內發送推送通知
例如:如果用戶選擇,則應該將通知發送給已安裝我的應用並且距離用戶(廣播通知的用戶)當前位置100英里內的所有用戶。
我發現對於同在解析網站的代碼片段,但我沒有收到任何通知,如果我使用的是下面的代碼 方法didReceiveRemoteNotification
評論說,如果我使用第二種查詢 不叫第二個查詢。 只有當我使用第一個查詢時,我才能成功接收通知。
我更新的推送通知和解析。讓我知道,如果我錯過了一些愚蠢的東西,以便我可以修復它。我一直圍繞這個問題很長一段時間,所以,請大家幫忙。
PFGeoPoint *myLoc = [PFGeoPoint geoPointWithLatitude:myLatitude longitude:myLongitude];
PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"location"
nearGeoPoint:myLoc
withinMiles:100];
PFQuery *myQuery = [PFInstallation query];
[myQuery whereKey:@"deviceType" equalTo:@"ios"];
//[myQuery whereKey:@"user" matchesQuery:userQuery];
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
txt.text, @"alert",
@"1", @"badge",
@"sound.caf", @"sound",
nil];
PFPush *push = [[PFPush alloc] init];
[push setQuery:myQuery];
[push setData:data];
[push sendPushInBackground];
「位置」是地理點正確?你在安裝表中有'用戶'欄? – Jacob 2014-09-01 14:18:10
在地點欄你把緯度或經度分享的價值 – Maul 2014-09-02 05:56:46
@Jacob:我恐怕我沒有在我的後端表。它只是我看到並實施它的查詢。 – iCodeAtApple 2014-09-02 06:06:23