让模拟器也支持GPS定位(模拟实现)
来源:互联网 发布:java orm框架比较 编辑:程序博客网 时间:2024/05/18 00:05
iOS上的GPS定位一般需要真机才能看到效果,但在开发的过程中,一般都在模拟器上调试。那怎么办呢?我们可以使用Object-C的策略,给模拟器指定一个经纬度,这样,定位就可以在模拟器上实现了。RealTool为你实现一个简单的demo。
// 模拟器 宏定义
#ifdef TARGET_IPHONE_SIMULATOR
@interface CLLocationManager (Simulator)
@end
@implementation CLLocationManager (Simulator)
-(void)startUpdatingLocation
{
float latitude = 32.061;
float longitude = 118.79125;
CLLocation *setLocation= [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease];
[self.delegate locationManager:self didUpdateToLocation:setLocation
fromLocation:setLocation];
}
@end
#endif // TARGET_IPHONE_SIMULATOR
这样,在调用startUpdatingLocation的时候,就会自己调用返回经纬度的函数了。
// 模拟器 宏定义
#ifdef TARGET_IPHONE_SIMULATOR
@interface CLLocationManager (Simulator)
@end
@implementation CLLocationManager (Simulator)
-(void)startUpdatingLocation
{
float latitude = 32.061;
float longitude = 118.79125;
CLLocation *setLocation= [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease];
[self.delegate locationManager:self didUpdateToLocation:setLocation
fromLocation:setLocation];
}
@end
#endif // TARGET_IPHONE_SIMULATOR
这样,在调用startUpdatingLocation的时候,就会自己调用返回经纬度的函数了。
- 让模拟器也支持GPS定位(模拟实现)
- 让模拟器也支持GPS定位(模拟实现)
- android模拟器模拟定位GPS
- android模拟器模拟定位GPS
- Android_android模拟器模拟定位GPS
- android模拟器模拟定位GPS
- 让IE6也支持fixed定位
- android模拟器定位GPS
- 让IE6也支持hover[JS模拟]
- GPS定位模拟测试
- Android GPS 定位的实现(1)
- Android GPS定位实现
- GPS定位实例使用------模拟器开发
- Android模拟器调试GPS定位程序
- 在Android模拟器中模拟GPS
- IOS模拟器中GPS数据的模拟
- Android模拟器中模拟GPS、打电话、…
- 让低版本的浏览器也支持hover(JS实现)
- 2011-8-12 学习笔记—判断表中是否存在某个字段
- PDF编辑:Adobe Acrobat X Pro 官方原版下载+中文汉化补丁
- outerHTML、innerHTML和innerTEXT
- 结构体定义 typedef struct 用法详解和用法小结
- facebook与人人网的网站后台架构对比
- 让模拟器也支持GPS定位(模拟实现)
- asp.net生成伪静态2
- java中Synchronized的一个简单例子
- arm-linux-gcc和arm-elf-gcc 区别
- Android 之 远程图片获取和本地缓存
- poj 3808 Malfatti Circles
- oracle sql调优学习笔记(二)RBO Query Tuning 之Row cache order
- HashMap LinkedHashMap源码分析
- uClinux内核移植相关代码分析