ios – 使用UIImagePickerController访问照片库后崩溃

ios – 使用UIImagePickerController访问照片库后崩溃,第1张

概述点击按钮时访问照片库时遇到麻烦.像往常一样,我在问它是否可以访问.以下是我的代码 @IBAction func photoLibraryButtonTapped(sender: UIButton) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLi 点击按钮时访问照片库时遇到麻烦.像往常一样,我在问它是否可以访问.以下是我的代码

@IBAction func photolibrarybuttonTapped(sender: UIbutton) {        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Photolibrary) {            let imagePicker = UIImagePickerController()            imagePicker.delegate = self            imagePicker.sourceType = UIImagePickerControllerSourceType.Photolibrary            imagePicker.allowsEditing = true            self.presentVIEwController(imagePicker,animated: true,completion: nil)        }    }

这是Xcode所说的:

2016-08-08 23:05:11.209 Auyrma[1799:20237892] -[UIVIEwController photolibrarybuttonTapped:]: unrecognized selector sent to instance 0x7fd3e9d39ed02016-08-08 23:05:11.214 Auyrma[1799:20237892] *** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-[UIVIEwController photolibrarybuttonTapped:]: unrecognized selector sent to instance 0x7fd3e9d39ed0'*** First throw call stack:(    0   CoreFoundation                      0x0000000113fdcd85 __exceptionPreprocess + 165    1   libobjc.A.dylib                     0x0000000113a50deb objc_exception_throw + 48    2   CoreFoundation                      0x0000000113fe5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205    3   CoreFoundation                      0x0000000113f2bcfa ___forwarding___ + 970    4   CoreFoundation                      0x0000000113f2b8a8 _CF_forwarding_prep_0 + 120    5   UIKit                               0x00000001124d6a8d -[UIApplication sendAction:to:from:forEvent:] + 92    6   UIKit                               0x0000000112649e67 -[UIControl sendAction:to:forEvent:] + 67    7   UIKit                               0x000000011264a143 -[UIControl _sendActionsForEvents:withEvent:] + 327    8   UIKit                               0x0000000112649263 -[UIControl touchesEnded:withEvent:] + 601    9   UIKit                               0x000000011254999f -[UIWindow _sendtouchesForEvent:] + 835    10  UIKit                               0x000000011254a6d4 -[UIWindow sendEvent:] + 865    11  UIKit                               0x00000001124f5dc6 -[UIApplication sendEvent:] + 263    12  UIKit                               0x00000001124cf553 _UIApplicationHandleEventQueue + 6660    13  CoreFoundation                      0x0000000113f02301 __CFRUNLOOP_IS_CALliNG_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17    14  CoreFoundation                      0x0000000113ef822c __CFRunLoopDoSources0 + 556    15  CoreFoundation                      0x0000000113ef76e3 __CFRunLoopRun + 867    16  CoreFoundation                      0x0000000113ef70f8 CFRunLoopRunspecific + 488    17  GraphiCSServices                    0x00000001164bcad2 GSEventRunModal + 161    18  UIKit                               0x00000001124d4f09 UIApplicationMain + 171    19  Auyrma                              0x000000010e1c2d82 main + 114    20  libdyld.dylib                       0x0000000114e8492d start + 1    21  ???                                 0x0000000000000001 0x0 + 1)libc++abi.dylib: terminating with uncaught exception of type NSException
解决方法 1.请检查视图控制器和故事板文件的目标应该在同一目标中.
2.选择您的xib并删除映射到该故事板的类并将其映射回来,并在粘贴您的类后按Enter键,您的笔尖名称保持相同以进行测试.
3.如果此按钮正在加载表单自定义视图,则视图控制器需要检查自定义视图是否已添加到右目标,并再次使用ibaction重新映射内部.

通过查看您的对话,我可以解决这个问题.

总结

以上是内存溢出为你收集整理的ios – 使用UIImagePickerController访问照片库后崩溃全部内容,希望文章能够帮你解决ios – 使用UIImagePickerController访问照片库后崩溃所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1209464.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存