有没有人想用iPhone找到真正的方向?我想实现这样的应用程序,其中我需要找到iPhone指向的方向,并希望使应用程序与iphone 3GS中的指南针应用程序相同.
iPhone 3G是否支持罗盘功能?并且任何人都可以告诉我罗盘应用程序如何像真正的磁罗盘那样准确地找到方向吗?
请帮帮我.我处于危急的境地.
提前致谢.
iphone direction cllocationmanager map-directions compass-geolocation
我有一个名为"myLocation"的CLLocation管理器.
myLocation = [[CLLocationManager alloc] init];
myLocation.desiredAccuracy = kCLLocationAccuracyBestForNavigation ;
myLocation.distanceFilter = 10 ;
myLocation.delegate=self;
locationEnabledBool = [CLLocationManager locationServicesEnabled];
if (locationEnabledBool ==NO || ( [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied)) {
// LocationText.text = @"Location Service Disabled ";
UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:@"Location Service Disabled"
message:@"To re-enable, please go to Settings and turn on Location Service for this app."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[locationAlert show];
[locationAlert release];
}
[myLocation startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)
和位置更新功能是
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"old location is …Run Code Online (Sandbox Code Playgroud) 我想知道我是否可以在Xcode Simulator中测试重要更改位置服务(startMonitoringSignificantLocationChanges方法),或者它只适用于实际设备.请注意,我已经在模拟器中尝试了它并且它不起作用,但我不确定这是否只是因为它不能在模拟器上工作或因为我做错了什么.
谢谢
我正在使用我Location Services的一些应用程序.我有一个方法,我在我的locationManager:didUpdateToLocation:fromLocation:方法中用来过滤掉不良,不准确或太远的位置.并尽量减少gps"抖动".这是我使用的:
/**
* Check if we have a valid location
*
* @version $Revision: 0.1
*/
+ (BOOL)isValidLocation:(CLLocation *)newLocation withOldLocation:(CLLocation *)oldLocation {
// Filter out nil locations
if (!newLocation) return NO;
// Filter out points by invalid accuracy
if (newLocation.horizontalAccuracy < 0) return NO;
if (newLocation.horizontalAccuracy > 66) return NO;
// Filter out points by invalid accuracy
#if !TARGET_IPHONE_SIMULATOR
if (newLocation.verticalAccuracy < 0) return NO;
#endif
// Filter out points that are out of order …Run Code Online (Sandbox Code Playgroud) 我正在为iPhone开发一个位置日记应用程序,我正在尝试使用iOS 8的新访问监控API.我已经阅读了Xcode文档并观看了WWDC 2014视频,我想我已经正确实现了startMonitoringVisits和didVisit方法.但是,在构建应用程序的其余部分之前,我想知道它们是否确实在工作.
如何确定我的应用是否正在接收访问数据?有没有办法在Xcode中使用iPhone模拟器来测试访问事件?或者我是否真的要到处走走,在不同的地方停留并等待访问注册?
如果有任何代码示例都在Swift中,我真的很感激,因为我对它更加满意,但我不想过于苛刻,所以如果你有一些Objective-C例子,请不要犹豫.
谢谢.
编辑:我最初询问访问监控是否在"设置">"隐私">"位置服务">"系统服务"中关闭"常用位置"时有效.我做了一些测试,答案是肯定的,即使用户关闭了常用位置,访问监控也能正常工作.该设置似乎仅适用于内置访问跟踪,例如地图应用.
我为我的应用设置了(默认iOS8)基于位置的通知.
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.regionTriggersOnce = NO;
notification.userInfo = @{ @"notification_id" : @"someID" };
notification.region = region;
notification.alertBody = alertBody;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
Run Code Online (Sandbox Code Playgroud)
当用户进入指定区域时,通知将NotificationCenter正确显示.
但是,我想在用户退出该区域时删除该通知消息,因为用户回家并查看通知中心直到他们收到如下所示的消息是没有意义的:
"你在XXXXX!"
有没有人尝试类似的东西?文档不清楚如何做到这一点.
我已经对此提出了雷达,但我想知道是否有其他人有这个问题.
似乎重要的位置更改(SLC)在iOS 11上表现不同,但仅限于在Xcode 9上构建的应用程序.看起来好像SLC表现得更糟,并且与iOS 10相比延迟了.我可以支持这个使用来自多个设备的数据和易于重复的实验.我想尝试保持这篇文章的简短,所以如果有人想要更多关于如何更详细地重现问题的数据或说明,我很高兴能够分享我如何做到这一切.
使用这个简约的SLC缓存应用程序:https://github.com/Root-App/root-ios-slc-tester我能够从iOS 10和iOS 11设备获取数据.
问题仅存在于iOS 11设备上,其中接收SLC的应用程序已构建在Xcode 9上.只是为了确保这一点清楚:
大多数时候(但并非总是如此),iOS 11 + Xcode 9版本上的SLC发生的时间明显晚于控制(iOS 10)设备上的SLC.
比较来自上述应用程序的日志文件,iOS 10设备在iOS 11设备之前超过2分钟获得SLC.有时10-15分钟前!
样本删节数据,其中每一行是不同的行程,并表示第一次记录该行程的SLC(以HH:mm:ss):
iOS 10 | iOS 11
-------------------
20:41:08 | 20:44:45
07:21:25 | 07:27:48
18:54:57 | 19:07:36
07:48:17 | 07:51:03
17:29:44 | 17:38:18
Run Code Online (Sandbox Code Playgroud)
iOS 10与iOS 11中存在SLC之间的差距似乎有所不同.
是否有其他人看到这种降级的SLC行为?
我有一个位置服务应用程序,其中提供了用户的高程.但我发现CLLocationManager提供的高程精度非常不准确.当我两次测试相同的两个点时,有时高程差是四十英尺,有时是一百.有什么办法可以提高CLLocation的垂直精度,还是有不同的方法来获取用户的高程(第三方库)?我已经尝试检查CLLocationManager提供的newLocation的verticalAccuracy属性,如果它还不够,则抛出它,但即使它足够"准确",它仍然通常不准确.谢谢你的时间!
现在我正在使用:
if([newLocation verticalAccuracy] < 30) {
if(isCustomary)
altitudeLabel.text = [NSString stringWithFormat:@"%.2f feet", ([newLocation altitude] * 3.2808399)];
else
altitudeLabel.text = [NSString stringWithFormat:@"%.2f meters", [newLocation altitude]];
}
Run Code Online (Sandbox Code Playgroud)
该代码存在问题:通常,verticalAccuracy永远不会低于30,而当它完成时,它甚至还不够准确; 我测试了在我家附近行走的代码(一个故事),它说海拔高度变化到19英尺,我确信这不是真的.
我正在开发一款监控iBeacon地区的iOS应用程序.当应用程序在后台运行时,我希望它在遇到特定的iBeacon区域时发送本地通知.一切正常,除了一件事:locationManager:didEnterRegion显然不会被调用,直到用户显示锁定屏幕.因此,即使设备在应用程序处于后台时通过iBeacon区域,他们也不会在显示锁定屏幕之前收到通知.
我也尝试过使用startMonitoringForRegion,这种工作方式 - 如果应用程序在后台运行,则locationManager:didDetermineState:当设备进入iBeacon区域时触发.但是,它只执行一次 - 如果用户随后退出并重新进入iBeacon区域,则locationManager:didDetermineState不会再次触发.
我正在运行iPhone 5s并使用iPhone 4s作为iBeacon,如果这有任何区别的话.
更正:当我使用iPhone 4s作为客户端时,这种现象显然只会发生.如果我使用5s,通知会立即发送.
<key>NSLocationAlwaysUsageDescription</key>
<array>
<string>Location is required to find out where you are</string>
</array>
<key>Privacy-Location Usage Description</key>
<string>Location is required to find out where you are.</string>
Run Code Online (Sandbox Code Playgroud)
我在info.plist中添加了这个.仍然权限弹出窗口没有显示添加的字符串,而是显示 - 即使您不使用应用程序,也允许"app"访问您的位置?