Have multiple buttons have the same function? - ios

I am creating an app where I need a button that generates more buttons. I have my code like this:
func showButtons(array:Array<UIButton>)
{
for(var i:Int = 0; i < array.count; i++)
{
array[i].setImage(UIImage(named: "StartButton.png"), forState: UIControlState.Normal)
array[i].frame = CGRectMake(CGFloat(arc4random_uniform(200)), CGFloat(arc4random_uniform(200)), 100, 100)
array[i].addTarget(self, action: "pressed", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(array[i])
}
}
The pressed button is this:
func pressed(sender:AnyObject?)
{
maybe()
}
But I know that is not the problem because another button, which was not create programmatically and has it's own action function, uses the same function and does not crash.
My crash report is here:
(104.0, 70.0)
2016-02-02 10:34:11.267 Test[5150:1087940] -[Test.ViewController pressed]: unrecognized selector sent to instance 0x7f8a8ac3be90
2016-02-02 10:34:11.283 Test[5150:1087940] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Test.ViewController pressed]: unrecognized selector sent to instance 0x7f8a8ac3be90'
* First throw call stack:
(
0 CoreFoundation 0x0000000101c81e65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001039c1deb objc_exception_throw + 48
2 CoreFoundation 0x0000000101c8a48d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000101bd790a ___forwarding_ + 970
4 CoreFoundation 0x0000000101bd74b8 _CF_forwarding_prep_0 + 120
5 UIKit 0x00000001024a0194 -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x000000010260f6fc -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010260f9c8 -[UIControl _sendActionsForEvents:withEvent:] + 311
8 UIKit 0x000000010260eaf8 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x000000010250f49b -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x00000001025101d0 -[UIWindow sendEvent:] + 865
11 UIKit 0x00000001024beb66 -[UIApplication sendEvent:] + 263
12 UIKit 0x0000000102498d97 _UIApplicationHandleEventQueue + 6844
13 CoreFoundation 0x0000000101bada31 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
14 CoreFoundation 0x0000000101ba395c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x0000000101ba2e13 __CFRunLoopRun + 867
16 CoreFoundation 0x0000000101ba2828 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000106297ad2 GSEventRunModal + 161
18 UIKit 0x000000010249e610 UIApplicationMain + 171
19 Test 0x0000000101aa134d main + 109
20 libdyld.dylib 0x00000001044ca92d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I believe my problem is I have all of e buttons attached to the action "pressed" so it sends a crash. Does anyone know a way to fix this/replace this. I have looked at the posts showing how to programmatically make a UIButton in Swift.

Your code has not problem at all with the number of UIButton associated to the same function, you're missing the colon at the end of the selector for the UIBUtton as your function receive a parameter in his signature, so you need to change the following line:
array[i].addTarget(self, action: "pressed:", forControlEvents:.TouchUpInside)
I hope this help you.

thanks to God (or Latter... ) now on Xcode 8 / Swift 3 syntax is cleaner, so no need to add (:_); compiler will find the method.
so the following code works fine:
override func viewDidLoad() {
super.viewDidLoad()
btn.addTarget(self, action: #selector(buttonTapped), for: UIControlEvents.touchUpInside)
}
final func buttonTapped(sender: UIButton){
}
if You try to mess compiler, i.e:
final func buttonTapped(sender: UIButton. fake: int){..
You will be called (as signature is correct..) but the parameter "fake" will get garbage from stack.
Of course:
final func buttonTapped(){..
works and is called. (no param is taken from stack).
By the way I prefer old syntax that required multiple ":" for every param, as per previous code:
"pressed:"

Related

Why do I get an "unrecognized selector" error with my IBAction?

I want to open a web page through a link. I'm using the address as a global variable. However, when I run a global function, an error occurs. What is the reason?
GlobalValue.swift
import Foundation
struct Global {
let apiAddress = "http://11.111.111.111:11111/"
let LinkURL: String
let LinkSecond : String
init()
{
agreeLinkURL = "User?type=webview"
agreeLinkSecond = "User2?type=webview"
}
func getURL() -> String {
return apiAddress + LinkURL
}
func getURLSecond() -> String {
return apiAddress + LinkSecond
}
}
Usage
let dataUrl = Global()
class ViewController: UIViewController {
...
#IBAction func DetailFuc(_ sender: Any) {
let detailUrl = dataUrl.getURL() // get error
print("***********************************************")
print(detailUrl)
print("***********************************************")
if let appURL = URL(string: detailUrl) {
UIApplication.shared.open(appURL) { success in
if success {
print("The URL was delivered successfully.")
} else {
print("The URL failed to open.")
}
}
} else {
print("Invalid URL specified.")
}
}
Error is:
2019-09-05 15:03:06.094723+0900 testap[24311:376425] -[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480
2019-09-05 15:03:06.102115+0900 testap[24311:376425] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105a618db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000103fb8ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000105a7fc94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKitCore 0x000000010f0bb235 -[UIResponder doesNotRecognizeSelector:] + 287
4 CoreFoundation 0x0000000105a66623 ___forwarding___ + 1443
5 CoreFoundation 0x0000000105a68418 _CF_forwarding_prep_0 + 120
6 UIKitCore 0x000000010f090624 -[UIApplication sendAction:to:from:forEvent:] + 83
7 UIKitCore 0x000000010eae58d5 -[UIControl sendAction:to:forEvent:] + 67
8 UIKitCore 0x000000010eae5bf2 -[UIControl _sendActionsForEvents:withEvent:] + 450
9 UIKitCore 0x000000010eae4ba8 -[UIControl touchesEnded:withEvent:] + 583
10 UIKitCore 0x000000010f0c94e6 -[UIWindow _sendTouchesForEvent:] + 2547
11 UIKitCore 0x000000010f0cabca -[UIWindow sendEvent:] + 4079
12 UIKitCore 0x000000010f0a930e -[UIApplication sendEvent:] + 356
13 UIKitCore 0x000000010f1792b3 __dispatchPreprocessedEventFromEventQueue + 3232
14 UIKitCore 0x000000010f17bbd9 __handleEventQueueInternal + 5911
15 CoreFoundation 0x00000001059c8db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 CoreFoundation 0x00000001059c8633 __CFRunLoopDoSources0 + 243
17 CoreFoundation 0x00000001059c2cef __CFRunLoopRun + 1231
18 CoreFoundation 0x00000001059c24d2 CFRunLoopRunSpecific + 626
19 GraphicsServices 0x000000010a69f2fe GSEventRunModal + 65
20 UIKitCore 0x000000010f08efc2 UIApplicationMain + 140
21 testap 0x00000001035c31eb main + 75
22 libdyld.dylib 0x0000000107dcf541 start + 1
)
l
ibc++abi.dylib: terminating with uncaught exception of type NSException
Something must have been wrong when I set up a global variable, but I don't know what went wrong. Please let me know how to solve this. Is the method of calling a webpage the right way?
As you can see here:
reason: '-[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480'
That's not the issue. The reason of the crash is you renamed Detailfuc to DetailFuc with capital F. So it can not find the original function with lowercase f and crashed.
You should disconnect the wrong IBAction from the button eachtime you change the target.
You can right click on the button to see the connections and then click on x for the wrong connection with lowercase f
(reason: '-[testap.ViewController Detailfuc:]: unrecognized selector)
when you connect the outlet object in storyboard to it's code in the view controller, you can't modify the name any time before you disconnect it by right clicking on the object in story board and press on the x button that link the object with the code, and after modifying the name from code link it again.

Error while Changing the image of the button from an image to another when clicked on the button

Here is my code :
#IBAction func moreClicked(_ sender: UIButton) {
if sender.currentImage == #imageLiteral(resourceName: "more_off"){
sender.setImage(#imageLiteral(resourceName: "more_on"), for: .normal)
}
else
{
sender.setImage(#imageLiteral(resourceName: "more_off"), for: .normal)
}
}
I am getting this error:
2018-09-05 11:03:28.708661+0530 musicPlayer[25450:590989]
-[musicPlayer.SecondViewController more:]: unrecognized selector sent to instance 0x7fc1d4606d00
2018-09-05 11:03:28.715659+0530 musicPlayer[25450:590989] *
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason:
'-[musicPlayer.SecondViewController more:]: unrecognized selector sent
to instance 0x7fc1d4606d00'
* First throw call stack: ( 0 CoreFoundation 0x00000001087ea1e6 exceptionPreprocess + 294 1 libobjc.A.dylib
0x0000000107a36031 objc_exception_throw + 48 2 CoreFoundation
0x000000010886b784 -[NSObject(NSObject) doesNotRecognizeSelector:] +
132 3 UIKit 0x0000000108e956db
-[UIResponder doesNotRecognizeSelector:] + 295 4 CoreFoundation 0x000000010876c898 ___forwarding_ + 1432 5 CoreFoundation
0x000000010876c278 _CF_forwarding_prep_0 + 120 6 UIKit
0x0000000108c683e8 -[UIApplication sendAction:to:from:forEvent:] + 83
7 UIKit 0x0000000108de37a4
-[UIControl sendAction:to:forEvent:] + 67 8 UIKit 0x0000000108de3ac1 -[UIControl _sendActionsForEvents:withEvent:] + 450
9 UIKit 0x0000000108de2a09
-[UIControl touchesEnded:withEvent:] + 580 10 UIKit 0x0000000108cdd0bf -[UIWindow _sendTouchesForEvent:] + 2729 11 UIKit
0x0000000108cde7c1 -[UIWindow sendEvent:] + 4086 12 UIKit
0x0000000108c82310 -[UIApplication sendEvent:] + 352 13 UIKit
0x00000001095c36af dispatchPreprocessedEventFromEventQueue + 2796
14 UIKit 0x00000001095c62c4
__handleEventQueueInternal + 5949 15 CoreFoundation 0x000000010878cbb1
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 16 CoreFoundation 0x00000001087714af
__CFRunLoopDoSources0 + 271 17 CoreFoundation 0x0000000108770a6f __CFRunLoopRun + 1263 18 CoreFoundation
0x000000010877030b CFRunLoopRunSpecific + 635 19 GraphicsServices
0x000000010ff76a73 GSEventRunModal + 62 20 UIKit
0x0000000108c67057 UIApplicationMain + 159 21 musicPlayer
0x000000010711cc27 main + 55 22 libdyld.dylib
0x000000010cd4f955 start + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
2018-09-05 11:03:28.708661+0530 musicPlayer[25450:590989]
-[musicPlayer.SecondViewController more:]: unrecognized selector sent to instance 0x7fc1d4606d00
The above message means that SecondViewController expects to have method called more: but when the action is triggered and instance from this class tries to find the more: method, it does not recognise such method and the application crashes.
What I think has happened here is: you have dragged action from your Xib/Storyboard to your VC class and named it more:. After this you have renamed it manually (not Refactor > Rename) to moreClicked:. This way the IBAction of the SecondViewController still points to method that is called more:, however your class does not have such method anymore.
So basically, you need to remove the already existing reference of the IBAction from your xib/storyboard and reconnect it with the new method: moreClicked:, and all should be working.

crash after accessing photo library using UIImagePickerController

I am having troubles with accessing Photo Library when the button is tapped. Just as usual I am asking if it is accessible. Below is my 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 is what Xcode says:
2016-08-08 23:05:11.209 Auyrma[1799:20237892] -[UIViewController photoLibraryButtonTapped:]: unrecognized selector sent to instance 0x7fd3e9d39ed0
2016-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.Please check target of your view controller and storyboard files should be in same target.
2.select your xib and remove your class which is mapped to that storyboard and map it back and press enter once you paste your class your nib name keep same for testing.
3.If this button is loading form custom view to view controller need to check that custom views are added to right target and re-map touch up inside with ibaction again.
This is what I could figure it out by see your conversations.
I have solved my problem this way:
Open up the Utilites
Open the Identity Inspector
Provide the class name again (however it was there already)
It seems like it was a bug of Xcode...

swift Turn a generated imageView into a UIButton in code

I am trying to add a tap gesture to a generated Image and it works ok but keeps crashing the program once I click on the image. What did I do wrong here. Any help is appreciated.
let tapGesture = UITapGestureRecognizer(target: self, action: "image Tapped")
let imageView = UIImageView(image: UIImage(data: data));
imageView.addGestureRecognizer(tapGesture)
imageView.userInteractionEnabled = true
This is the error I get
2016-07-12 09:19:30.241 XXX[2170:27661] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ‘-[MyViewController image Tapped]: unrecognized selector sent to instance 0x7fe811e30560'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e2a7d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000011144ddeb objc_exception_throw + 48
2 CoreFoundation 0x000000010e2b0d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010e1f6cfa ___forwarding___ + 970
4 CoreFoundation 0x000000010e1f68a8 _CF_forwarding_prep_0 + 120
5 UIKit 0x0000000110391b28 _UIGestureRecognizerSendTargetActions + 153
6 UIKit 0x000000011038e19a _UIGestureRecognizerSendActions + 162
7 UIKit 0x000000011038c197 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 843
8 UIKit 0x0000000110394655 ___UIGestureRecognizerUpdate_block_invoke898 + 79
9 UIKit 0x00000001103944f3 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 342
10 UIKit 0x0000000110381e75 _UIGestureRecognizerUpdate + 2634
11 UIKit 0x000000010ff0e48e -[UIWindow _sendGesturesForEvent:] + 1137
12 UIKit 0x000000010ff0f6c4 -[UIWindow sendEvent:] + 849
13 UIKit 0x000000010febadc6 -[UIApplication sendEvent:] + 263
14 UIKit 0x000000010fe94553 _UIApplicationHandleEventQueue + 6660
15 CoreFoundation 0x000000010e1cd301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 CoreFoundation 0x000000010e1c322c __CFRunLoopDoSources0 + 556
17 CoreFoundation 0x000000010e1c26e3 __CFRunLoopRun + 867
18 CoreFoundation 0x000000010e1c20f8 CFRunLoopRunSpecific + 488
19 GraphicsServices 0x0000000112d68ad2 GSEventRunModal + 161
20 UIKit 0x000000010fe99f09 UIApplicationMain + 171
21 ApivitaClient 0x000000010d6a1482 main + 114
22 libdyld.dylib 0x0000000111f1192d start + 1
23 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
replace
let tapGesture = UITapGestureRecognizer(target: self, action: "image Tapped")
with
let tapGesture = UITapGestureRecognizer(target:self, action: #selector(imageTapped))
and create func imageTapped() {}
The action part in the UITapGestureRecognizer initializer means which method will be executed. And the action part means who's responsible for that action, who's the delegate.
Use this to initialize the gesture recognizer:
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: Selector("imageTapped:"))
Please note the colon : after the name of the method (imageTapped). This means the gesture recognizer will call the imageTapped method and pass the sender parameter, which it will be useful if you want to determine which gesture recognizer was triggered. This is really useful if you have several images that can be tapped, so you don't have to build a method for each one.
Then you need to declare the imageTapped method:
func imageTapped(sender: UIGestureRecognizer) {
print("Image tapped")
}
You can declare the function to work without parameter as well, just declare the function without the sender parameter and delete the colon in the action selector. Anyway, I recommend to keep it, it may be useful somewhere and it's better if you learn it that way.

Unrecognized Selector Swift 2 Purelayout Xcode7

Hello having an issue with an unrecognized selector sent to an instance exception I have searched around a bit but I've been unable to find a solution.
The error I believe is occurring in my use of PureLayout but still unsure of what is specifically causing the issue. One weird thing is that after using Carthage to make my purelayout framework I had to use a weird bridging header in order to import purelayout usually you import PureLayout.h but my code would not compile unless I imported PureLayout_Ios/Purelayout.h in my bridging header. And so I have to import PureLayout_iOS in my viewcontroller.
View:
var presenter: SignUpPresenterProtocol?
//lazy var logoImageView: UIImageView = UIImageView()
lazy var nextButton: UIButton = {
var button = UIButton()
button.backgroundColor = Styles.BUTTON_COLOR
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
self.setupSubviews()
self.setupConstraints()
self.setNeedsStatusBarAppearanceUpdate()
self.presenter?.viewDidLoad()
}
private func setupSubviews()
{
self.view.addSubview(self.nextButton)
self.view.addSubview(self.userNameTextField)
self.nextButton.addTarget(self, action: Selector("userDidSelectNext:"), forControlEvents: UIControlEvents.TouchUpInside)
//self.view.addSubview(self.logoImageView)
}
private func setupConstraints()
{
self.nextButton.translatesAutoresizingMaskIntoConstraints = false
self.nextButton.autoMatchDimension(.Width, toDimension: .Width, ofView: self.view, withMultiplier: 0.8)
self.nextButton.autoSetDimension(.Height, toSize: Styles.BUTTON_HEIGHT)
self.nextButton.autoCenterInSuperview()x
}
func userDidSelectNext(sender: AnyObject)
{
self.presenter?.userDidSelectNext()
}
And here is the error stack trace:
2015-07-28 08:51:58.218 app[10795:507285] -[UIButton autoMatchDimension:toDimension:ofView:withMultiplier:]: unrecognized selector sent to instance 0x7f9d02f8cad0
2015-07-28 08:51:58.222 app[10795:507285] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton autoMatchDimension:toDimension:ofView:withMultiplier:]: unrecognized selector sent to instance 0x7f9d02f8cad0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001079e18b5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001095c1df3 objc_exception_throw + 48
2 CoreFoundation 0x00000001079e9ead -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010793819a ___forwarding___ + 970
4 CoreFoundation 0x0000000107937d48 _CF_forwarding_prep_0 + 120
5 app 0x0000000107324984 _TFC7app12UsernameViewP33_A6105A8D44322785BCD6FD80914CAE7C16setupConstraintsfS0_FT_T_ + 180
6 app 0x000000010732422d _TFC7app12UsernameView11viewDidLoadfS0_FT_T_ + 93
7 app 0x0000000107324312 _TToFC7app12UsernameView11viewDidLoadfS0_FT_T_ + 34
8 UIKit 0x000000010837fa6e -[UIViewController loadViewIfRequired] + 860
9 UIKit 0x000000010837fdbd -[UIViewController view] + 27
10 UIKit 0x00000001082607e4 -[UIWindow addRootViewControllerViewIfPossible] + 61
11 UIKit 0x0000000108260ee1 -[UIWindow _setHidden:forced:] + 302
12 UIKit 0x00000001082726fc -[UIWindow makeKeyAndVisible] + 43
13 app 0x0000000107326afc _TFC7app11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 588
14 app 0x0000000107326c43 _TToFC7app11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179
15 UIKit 0x00000001081f2bc4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
16 UIKit 0x00000001081f3cea -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3287
17 UIKit 0x00000001081f9e97 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
18 UIKit 0x00000001081f7635 -[UIApplication workspaceDidEndTransaction:] + 188
19 FrontBoardServices 0x000000010c2b0b5e -[FBSSerialQueue _performNext] + 192
20 FrontBoardServices 0x000000010c2b0ecc -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x000000010790e171 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x000000010790409c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x0000000107903553 __CFRunLoopRun + 867
24 CoreFoundation 0x0000000107902f68 CFRunLoopRunSpecific + 488
25 UIKit 0x00000001081f6fd2 -[UIApplication _run] + 402
26 UIKit 0x00000001081fb6f8 UIApplicationMain + 171
27 app 0x0000000107327e0d main + 109
28 libdyld.dylib 0x000000010a5f892d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
thank you guys!
Try replacing this line...
self.nextButton.addTarget(self, action: Selector("userDidSelectNext:"), forControlEvents: UIControlEvents.TouchUpInside)
with this instead...
self.nextButton.addTarget(self, action: "userDidSelectNext:", forControlEvents: UIControlEvents.TouchUpInside)
You can find more info in the apple document here: Objective C Selectors
After using carthage to update my purelayout library it was fixed, not sure what the issue was though, here is the latest changlog on github.

Resources