Ios 使用未解析标识符';requestIPViewController',对成员'的模糊引用;下标';
它告诉我代码上有一些问题 那我该怎么解决呢Ios 使用未解析标识符';requestIPViewController',对成员'的模糊引用;下标';,ios,iphone,swift,xcode,identifier,Ios,Iphone,Swift,Xcode,Identifier,它告诉我代码上有一些问题 那我该怎么解决呢 self.presentViewController[requestIPViewController, animated:YES, completion:nil]; } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { let image = info
self.presentViewController[requestIPViewController, animated:YES, completion:nil];
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
let image = info[UIImagePickerControllerOriginalImage] as UIImage
如果是在swift 2.3中,那么应该是这样的
self.presentViewController(imagePicker, animated: true, completion: nil)
self.present(imagePicker, animated: true, completion: nil)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let mediaType = info[UIImagePickerControllerMediaType] as! NSString
self.dismiss(animated: true, completion: nil)
if mediaType.isEqual(to: kUTTypeImage as String) {
let image = info[UIImagePickerControllerOriginalImage]
as! UIImage
}
}
而且你必须像这样打字
let image = info[UIImagePickerControllerOriginalImage]
as! UIImage
斯威夫特3.0看起来是这样的
self.presentViewController(imagePicker, animated: true, completion: nil)
self.present(imagePicker, animated: true, completion: nil)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let mediaType = info[UIImagePickerControllerMediaType] as! NSString
self.dismiss(animated: true, completion: nil)
if mediaType.isEqual(to: kUTTypeImage as String) {
let image = info[UIImagePickerControllerOriginalImage]
as! UIImage
}
}
detegate方法看起来是这样的
self.presentViewController(imagePicker, animated: true, completion: nil)
self.present(imagePicker, animated: true, completion: nil)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let mediaType = info[UIImagePickerControllerMediaType] as! NSString
self.dismiss(animated: true, completion: nil)
if mediaType.isEqual(to: kUTTypeImage as String) {
let image = info[UIImagePickerControllerOriginalImage]
as! UIImage
}
}
希望有帮助。您在哪里声明了requestIPViewController,信息是什么?请检查并告诉结果当它是Swift 3.0+时,它是相同的东西没有任何变化。你能拍一张它的屏幕截图吗?我想你还没有声明requestIPViewController,第一个错误就是因为这个,请检查