【发布时间】:2017-04-27 18:45:27
【问题描述】:
我正在学习 IOS 和 Android 中的应用程序开发,搜索后我不确定我是否得到了答案:我想构建一个应用程序,当其他用户(同一个应用程序)在附近时,它基本上会提醒用户.如果他们有共同的兴趣(以前用户填写某种表格),就会发出警报。我在 Stack Overflow 中找到了这段代码,但我不确定它是否能完成这种工作。谁能给我一些提示?
- (void) activateProximitySensor {
UIDevice *device = [UIDevice currentDevice];
device.proximityMonitoringEnabled = YES;
if (device.proximityMonitoringEnabled == YES) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(proximityChanged:) name:@"UIDeviceProximityStateDidChangeNotification" object:device];
}
}
- (void) proximityChanged:(NSNotification *)notification {
UIDevice *device = [notification object];
NSLog(@"Detectat");
//DO WHATEVER I WANT
}
【问题讨论】:
-
没有。那是为了感知用户的身体。您将不得不使用服务器端应用程序来跟踪您的用户(当授予权限时)并查找匹配项。
-
好的,谢谢你的回答
标签: ios objective-c