Ios NotificationCenter小部件无法使用CoreLocation

Ios NotificationCenter小部件无法使用CoreLocation,ios,widget,core-location,jailbreak,Ios,Widget,Core Location,Jailbreak,我正在编写一个通知中心小部件,它必须使用位置信息。在普通应用程序中,我使用CoreLocation,它工作正常。但是在我的小部件中,我尝试启用locationServicesEnabled,但它没有进入回调函数,authorizationStatus始终是KClautorizationStatusNotDetermined,并且授权设置没有显示在设置->位置服务中。我已经设置了该类的委托 该系统的Yahoo weather小部件可以自动定位,并且它也使用CoreLocation,因此该小部件确实

我正在编写一个通知中心小部件,它必须使用位置信息。在普通应用程序中,我使用CoreLocation,它工作正常。但是在我的小部件中,我尝试启用
locationServicesEnabled
,但它没有进入回调函数,
authorizationStatus
始终是
KClautorizationStatusNotDetermined
,并且授权设置没有显示在设置->位置服务中。我已经设置了该类的委托

该系统的Yahoo weather小部件可以自动定位,并且它也使用CoreLocation,因此该小部件确实能够使用定位服务

为什么CoreLocation在我的小部件上不起作用?


更新:2012.10.24 15:52

我使用私有API

[CLLocationManager设置授权状态:是
forBundle:[NSBundle bundleForClass:self.class]]
现在,授权设置显示在设置->位置服务中。每次我打开通知中心,它都会打开。但是
authorizationStatus
仍然是
kclauauthorizationstatusnotdetermined
,并且不会转到回调函数


更新:2012.10.25 10:38

我将我的定位码更改为:

[CLLocationManager setDefaultEffectiveBundle:[NSBundle bundleForClass:self.class]];
[_LocationManagerStartupDatingLocation];
如果我关闭定位服务,它将跳转到

-(void)locationManager:(CLLocationManager*)管理器错误:(NSError*)错误
如果我打开该服务,无论我是否授权,都不会回电话(两者都是)

-(void)locationManager:(CLLocationManager*)管理器错误:(NSError*)错误

-(void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
不会被调用)

顺便说一下,当我打开/关闭服务时

-(void)locationManager:(CLLocationManager*)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)状态

将被调用,但不会在我更改授权状态时调用。

可能是因为WeeAppPlugin捆绑包不是一个有效的捆绑包,导致小部件无法使用位置服务。在CoreLocation的私有API中I user
[[CLLocationManager alloc]initWithEffectiveBundle:[NSBundle bundleForClass:self.class]]
之后,小部件可以正常获取位置信息