gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:04:47 26 4
gpt4 key购买 nike

当我尝试将半径添加到防护应用程序时,我遇到了 [__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

最佳答案

试试这个

NSString *identifier = [[dictionary valueForKey:@"id"]stringvalue];

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com