小编JKo*_*oko的帖子

iOS 8 beta - 位置管理器未注册用户位置

自从新的iOS 8测试版发布以来,我无法成功获取用户的位置.在更新到iOS 8之前,我没有任何问题,但现在它总是返回0.000000作为当前纬度和经度.这只是新版本中的一个错误吗?我的代码如下:

//from the .h file
@interface MasterViewController : PFQueryTableViewController<CLLocationManagerDelegate,UITextFieldDelegate, UISearchBarDelegate, UISearchDisplayDelegate> {

}
@property (nonatomic, strong) CLLocationManager *locationManager;

//from the .m file
@synthesize locationManager = _locationManager;

- (void)viewDidLoad {
  [super viewDidLoad];
  [self.locationManager startUpdatingLocation];
}


- (CLLocationManager *)locationManager {
   if (_locationManager != nil) {
       return _locationManager;
   }

   _locationManager = [[CLLocationManager alloc] init];
   _locationManager.delegate = self;
   _locationManager.desiredAccuracy = kCLLocationAccuracyBest;

   return _locationManager;
}

 - (void)locationManager:(CLLocationManager *)manager
        didUpdateToLocation:(CLLocation *)newLocation
               fromLocation:(CLLocation *)oldLocation { 
}

 - (void)locationManager:(CLLocationManager *)manager
                    didFailWithError:(NSError *)error {
}
Run Code Online (Sandbox Code Playgroud)

更新 此问题已得到解答( …

core-location mapkit ios ios8

7
推荐指数
1
解决办法
4643
查看次数

手动呈现 PHPickerViewController 时如何显示当前选定的照片?

有没有办法在手动呈现时显示用户当前的照片选择PHPickerViewController?例如,使用以下代码时,选择器不会显示用户当前选择的任何照片。

 var pickerConfig = PHPickerConfiguration()
 pickerConfig.selectionLimit = 0
 pickerConfig.filter = .any(of: [.images])
            
 let imagePicker = PHPickerViewController(configuration: pickerConfig)
 imagePicker.delegate = self

 // When presented, the user's current selected photos are empty, nothing is selected
 viewController.present(imagePicker, animated: true)
Run Code Online (Sandbox Code Playgroud)

但是,如果我使用苹果的内置presentLimitedLibraryPicker功能,它确实会显示用户当前的照片选择:

// This does show the user's current selections
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from controller: self)
Run Code Online (Sandbox Code Playgroud)

有没有办法在不使用的情况下获得这种行为presentLimitedLibraryPicker

ios swift photokit ios14 phpickerviewcontroller

6
推荐指数
0
解决办法
1321
查看次数