ios - crash after accessing photo library using UIImagePickerController -


i having troubles accessing photo library when button tapped. usual asking if accessible. below code

@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)         }     } 

and here xcode says:

2016-08-08 23:05:11.209 auyrma[1799:20237892] -[uiviewcontroller photolibrarybuttontapped:]: unrecognized selector sent instance 0x7fd3e9d39ed0 2016-08-08 23:05:11.214 auyrma[1799:20237892] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiviewcontroller photolibrarybuttontapped:]: unrecognized selector sent 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 uncaught exception of type nsexception 

1.please check target of view controller , storyboard files should in same target. 2.select xib , remove class mapped storyboard , map , press enter once paste class nib name keep same testing. 3.if button loading form custom view view controller need check custom views added right target , re-map touch inside ibaction again.

this figure out see conversations.


Comments