gpt4 book ai didi

ios - Apple Watch coreLocation 错误 *** 断言失败 -[CLLocationManager requestLocation]

转载 作者:行者123 更新时间:2023-11-28 18:29:49 27 4
gpt4 key购买 nike

我尝试使用 coreLocation 获取用户在 Apple Watch 上的当前位置。每当我运行 -[CLLocationManager requestLocation] 时,应用程序都会退出并出现以下错误。

2016-02-07 16:38:39.392 Placescope Apple Watch Extension[6255:1471552]     *** Assertion failure in -[CLLocationManager requestLocation], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreLocationFramework_Sim/CoreLocation-1861.3.25.31/Framework/CoreLocation/CLLocationManager.m:8162016-02-07 16:38:39.395 Placescope Apple Watch Extension[6255:1471552] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Delegate must respond to locationManager:didUpdateLocations:'*** First throw call stack:(    0   CoreFoundation                      0x00bb9fc4 __exceptionPreprocess + 180    1   libobjc.A.dylib                     0x00671df4 objc_exception_throw + 50    2   CoreFoundation                      0x00bb9e5a +[NSException raise:format:arguments:] + 138    3   Foundation                          0x0029a008 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118    4   CoreLocation                        0x0013a4f9 CLClientGetCapabilities + 12683    5   Placescope Apple Watch Extension    0x0002edbf -[Recommendations awakeWithContext:] + 447    6   WatchKit                            0x000c2930 _WKInterfaceControllerCreateClass + 482    7   WatchKit                            0x000af002 __48-[SPRemoteInterface handlePlist:fromIdentifier:]_block_invoke_2 + 470    8   WatchKit                            0x000aebb9 __48-[SPRemoteInterface handlePlist:fromIdentifier:]_block_invoke + 1245    9   libdispatch.dylib                   0x0415a71b _dispatch_call_block_and_release + 15    10  libdispatch.dylib                   0x041783fd _dispatch_client_callout + 14    11  libdispatch.dylib                   0x04160fbe _dispatch_main_queue_callback_4CF + 689    12  CoreFoundation                      0x00b066fe __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14    13  CoreFoundation                      0x00ac49a4 __CFRunLoopRun + 2356    14  CoreFoundation                      0x00ac3db6 CFRunLoopRunSpecific + 470    15  CoreFoundation                      0x00ac3bcb CFRunLoopRunInMode + 123    16  Foundation                          0x0022dac1 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308    17  Foundation                          0x002d499d -[NSRunLoop(NSRunLoop) run] + 82    18  libxpc.dylib                        0x0448206f _xpc_objc_main + 486    19  libxpc.dylib                        0x04484dce xpc_main + 215    20  Foundation                          0x003fe3cd service_connection_handler + 0    21  PlugInKit                           0x035f1232 -[PKService run] + 582    22  WatchKit                            0x000d1549 main + 146    23  libdyld.dylib                       0x0419dad5 start + 1)libc++abi.dylib: terminating with uncaught exception of type NSException

This is my code:

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager requestWhenInUseAuthorization];
[locationManager requestLocation];

如果您有更好的方法来获取用户的位置,也请告诉我。

最佳答案

根据错误消息,'Delegate must respond to locationManager:didUpdateLocations:' 我必须实现 locationManager:didUpdateLocations:locationManager:didFailWithError: 在我的委托(delegate)中,以便使用 requestLocation。

关于ios - Apple Watch coreLocation 错误 *** 断言失败 -[CLLocationManager requestLocation],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35258894/

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