• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - NSCFNumber getCString maxLength编码在创建地理围栏时出错

[复制链接]
菜鸟教程小白 发表于 2022-12-12 10:46:59 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

当我尝试将半径添加到围栏应用程序时,出现[__NSCFNumber getCString:maxLength:encoding:]崩溃。
这是我的代码:

NSString *identifier = [dictionary valueForKey"id"];

CLLocationDegrees latitude = [[dictionary valueForKey"lat"] doubleValue];

CLLocationDegrees longitude =[[dictionary valueForKey"lon"] doubleValue];

CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake(latitude, longitude);

CLLocationDistance regionRadius = [[dictionary valueForKey"radius"] doubleValue];
NSLog(@"nslog is %f",regionRadius);


if(regionRadius > _locationManager.maximumRegionMonitoringDistance)
{
    regionRadius = _locationManager.maximumRegionMonitoringDistance;
}

NSString *version = [[UIDevice currentDevice] systemVersion];
CLRegion * region =nil;

if([version floatValue] >= 7.0f) // for iOS > 7
{
    region =  [[CLCircularRegion alloc] initWithCenter:centerCoordinate
                                                radius:regionRadius
                                            identifier:identifier];
}
else // for iOS < 7
{
    region = [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate
                                                     radius:regionRadius
                                                 identifier:identifier];
}

这里的Stacktrace是
0   KNOXXi                              0x00064c8b -[KCSDK dictToRegion:] + 854
1   KNOXXi                              0x000640cf -[KCSDK addGeofence:] + 86
2   KNOXXi                              0x00065d25 __25-[KCSDK reloadLocations:]_block_invoke + 536
3   KNOXXi                              0x0006369d __59-[KCSDK fetchNearbyFencesWithLocation:withSuccess:failure:]_block_invoke + 196
4   KNOXXi                              0x0002762d __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke46 + 36
5   libdispatch.dylib                   0x3992f833 <redacted> + 10
6   libdispatch.dylib                   0x3992f81f <redacted> + 22
7   libdispatch.dylib                   0x3993649f <redacted> + 278
8   CoreFoundation                      0x2e7648a1 <redacted> + 8
9   CoreFoundation                      0x2e763175 <redacted> + 1300
10  CoreFoundation                      0x2e6cdebf CFRunLoopRunSpecific + 522
11  CoreFoundation                      0x2e6cdca3 CFRunLoopRunInMode + 106
12  GraphicsServices                    0x33601663 GSEventRunModal + 138
13  UIKit                               0x3101a14d UIApplicationMain + 1136
14  KNOXXi                              0x00026411 main + 224
15  libdyld.dylib                       0x39954ab7 <redacted> + 2



Best Answer-推荐答案


试试这个

NSString * identifier = [[字典valueForKey“id”] stringvalue];

关于ios - NSCFNumber getCString maxLength编码在创建地理围栏时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24670443/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap