【发布时间】:2015-04-27 16:59:18
【问题描述】:
我正在开发一个应用程序,该应用程序向推送源 1 英里范围内的所有用户发送推送通知。有很多关于使用 Parse 进行基于位置的推送通知的好文档。我打算使用下面的代码(或类似的代码)来发送我的推送。
// Find users near a given location
PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"location"
nearGeoPoint:stadiumLocation
withinMiles:[NSNumber numberWithInt:1]]
// Find devices associated with these users
PFQuery *pushQuery = [PFInstallation query];
[pushQuery whereKey:@"user" matchesQuery:userQuery];
// Send push notification to query
PFPush *push = [[PFPush alloc] init];
[push setQuery:pushQuery]; // Set our installation query
[push setMessage:@"Free hotdogs at the Parse concession stand!"];
[push sendPushInBackground];
为了执行这个推送查询,我需要将每个用户的当前位置准确地存储在 Parse 数据库中。我计划使用 CoreLocation 来执行此操作,并且每次应用程序收到位置更改通知时,它都会更新用户在 Parse 数据库中的位置。这是最好的方法吗?我想象一个用户在全国旅行,他们的手机每英里更新一次解析数据库。是这种行为吗?这将需要每个用户非常频繁地更新 Parse 数据库。
我错过了什么吗?这真的是最好的方法吗?感谢您提供任何帮助或更好的想法。
【问题讨论】:
-
我认为您走在正确的轨道上,尽管您最终可能会达到解析请求数量的限制将允许免费计划,因此您可能需要考虑规模您的项目以及自定义设置是否更适用。
-
感谢您的回复。达到解析限制正是我担心的。如果我没有正确实施行为,我尤其不想达到极限。但似乎我是,所以我可能需要重新考虑设置。谢谢!
-
您不会立即达到免费计划的限制(30req/秒),这完全取决于您期望拥有的活跃用户数量
标签: ios parse-platform push-notification core-location