I'm getting this error:
[Clima.WeatherViewController searchPressed:]: unrecognized selector sent to instance 0x7f996b204020
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Clima.WeatherViewController searchPressed:]: unrecognized selector sent to instance 0x7f996b204020'
Here is my code:
IBOutlet weak var searchField: UITextField!
IBAction func searchedButtonPressed(_ sender: UIButton) {
searchField.endEditing(true);
print(searchField.text!)
}
You just have to disconnect you IBAction of your button & reconnect it. Because it seems that you had changed your IBAction function name after connect it. So your story board still has connection with old name search Pressed. & You already renamed it into searchedButtonPressed so your story board can not find this new name.
For disconnect your IBAction method:
right click on search button in story board & you will see connections you made in manu, close the connection with little colse button placed on top of the corner with the name searchPressed.
For reconnect your IBAction method:
Ctrl press on the keyboard & dreg on the search button to the small circle you will see beside your IBAction method.
I added the .h and .m files of this project and created a bridging header. I made sure that the bridging header location is entered correctly in project settings...
...and it imports the required file.
I have an UIView in my ViewController and its type is set to IPDFCameraViewController. In viewDidLoad() I'm calling a function in this class:
#IBOutlet weak var cameraViewController: IPDFCameraViewController!
override func viewDidLoad() {
super.viewDidLoad()
self.cameraViewController.setupCameraView()
self.cameraViewController.isBorderDetectionEnabled = true
}
I have no errors or warnings, but when it tries to execute cameraViewController.setupCameraView() it crashes and throws following:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setupCameraView]: unrecognized selector sent to instance 0x7ff1b0930620'
I'm probably missing something so simple but this is driving me crazy, what should I do?
You haven’t set the custom class for your view in the storyboard, so your outlet is referring to an instance of UIView, and of course UIView doesn’t have a function setupCameraView.
Error because you set UIView of type UIViewController. View controllers has to be added as childViiewControllers not through uiviews. In your storyboard add ContainerViewController, set it to your IPDFViewController and then make outlet
In my Xcode project I'm facing this issue with my IBOutlet and was wondering if anyone could help this troubleshoot.
its whenever I connect it only shows acton it also won't let me click and drag. Is there any way to fix this issue?
#IBOutlet weak var emailTextField: UITextField!
as you can see the connection won't allow me to change its grayed out.
How to fix this frustrating issue?
The objective is a bit unclear, however it seems you are trying to connect an IBOutlet in code with an exit IBAction in the IDE. This is not going to be possible. Either create a proper IBAction function for use with a manual unwind segue, make a normal action method, or simply point a proper object at the IBOutlet as needed. To review how to do this properly just use the Help > Xcode Help in Xcode to configure this correctly. For more info on making an unwind segue check out the technote.
I'm just a beginner in Swift coding. My idea is quite simple which is an app with two buttons. When clicked, a textfield will change its text.
In the Main.StoryBoard, I add a textfield and two buttons.
In ViewController.swift file. I write as this:
import UIKit
class ViewController: UIViewController {
#IBOutlet weak var textfield: UITextField!
#IBOutlet weak var button: UIButton!
#IBOutlet weak var button2: UIButton!
#IBAction func action1(_ sender: UIButton) {
textfield.text="you just clicked on button1"
}
#IBAction func action2(_ sender: UIButton) {
textfield.text="you just clicked on button2"
}
}
It is supposed to be all right. However, an error appears which shows:
thread1:signal SIGABRT
in file AppDelegate.swift line:
class AppDelegate: UIResponder, UIApplicationDelegate
What is wrong with my code?
You get a SIGABRT error whenever you have a disconnected outlet. Click on your view controller in the storyboard and go to connections in the side panel (the arrow symbol). See if you have an extra outlet there, a duplicate, or an extra one that's not connected. If it's not that then maybe you haven't connected your outlets to your code correctly.
Just remember that SIGABRT happens when you are trying to call an outlet (button, view, textfield, etc) that isn't there.
For me it wasn't an outlet. I solved the problem by going to the error And reading what it said. (Also Noob..)
This was the error:
And The solution was here:
Just scroll up in the output and the error will be revealed.
To solve the problem, first clean the project and then rebuild.
To clean the project, go to MenuBar: Product -> Clean
Then to rebuild the project, just click the Run button as usual.
A common reason for this type of error is that you might have changed the name of your IBOutlet or IBAction you can simply check this by going to source code.
Click on the main.storyboard and then select open as
and then select source code
source code will open
and then check whether there is the name of the iboutlet or ibaction that you have changed , if there is then select the part and delete it and then again create iboutlet or ibaction.
This should resolve your problem
In my case I wasn't getting error just the crash in the AppDelegate and I had to uncheck the next option: OS_ACTIVITY_MODE then I could get the real crash reason in my .xib file
Hope this can help you too :)
I had the same problem. I made a button in the storyboard and connected it to the ViewController, and then later on deleted the button. So the connection was still there, but the button was not, and so I got the same error as you.
To Fix:
Go to the connection inspector (the arrow in the top right corner, in your storyboard), and delete any unused connections.
If you run into this in Xcode 10 you will have to clean before build. Or, switch to the legacy build system. File -> Workspace Settings... -> Build System: Legacy Build System.
This is a very common error and can happen for multiple reasons. The most common is when an IBOUTLET/IBACTION connected to a view controller in the storyboard is deleted from the swift file but not from the storyboard. If this is not the case, use the log in the bottom toolbar to find out what the error is and diagnose it. You can use breakpoints and debugging to aid you in finding the error.
To find out how to fix the error please use this article that I found on Google: https://rayaans.com/fixing-the-notorious-sigabrt-error-in-xcode
In my case there was no log whatsoever.
My mistake was to push a view controller in a navigation stack that was already part of the navigation stack.
Sometimes it also happens when the function need to be executed in main thread only, so you can fix it by assigning it to the main thread as follows :-
DispatchQueue.main.async{
your code here
}
For me, This error was because i had a prepare segue step that wasn't applicable to the segue that was being done.
long story:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let gosetup = segue.destination as! Update
gosetup.wherefrom = updatestring
}
This was being done to all segue when it was only for one. So i create a boolean and placed the gosetup inside it.
In my case, I was using RxSwift for performing search.
I had extensively kept using a shared instance of a particular class inside the onNext method, which probably made it inaccessible (Mutex).
Make sure that such instances are handled carefully only when absolutely necessary.
In my case, I made use of a couple of variables beforehand to safely (and sequentially) store the return values of the shared instance's methods, and reused them inside onNext block.
I had the same problem. In my case I just overwrote the file
GoogleService-Info.plist
on that path:
Platform\ios\YOUR_APP_NAME\Resources\Resources
In my case the files were present without data.
If this crash occurs when accessing a view controller within a package you may have to remove the Class and Storyboard ID from the view controller within the package and then add them again, run the project and the view controller should be found
I have an app that is working fine in the app store on iOS 9. On iOS10 betas on device and in Xcode 8 simulator it is crashing when one of the tabs is tapped.
It crashes with the error
[PXPlaceholderView titleLabel]: unrecognized selector sent to instance
The screen (DiaryItemsViewController)is using a .xib file which reference PXPlaceholderView (a UIView sub class)
PXPlaceholderView has initWithFrame and initWithCoder methods that dont seem to get called on iOS10
In the primary screen (DiaryItemsViewController) I can set the background on the PXPlaceholderView ok, but cannot set the outlets
[self.placeholderView setBackgroundColor:[UIColor redColor]]; //works ok
self.placeholderView.titleLabel.text = NSLocalizedString(#"No Diary Entries", nil); //crashes
The outlets in the placeholder view appear to be set correctly in the xib and work find in Xcode 7/ios 9
PXPlaceholderView is an outlet in DiaryItemsViewController
#property (weak, nonatomic) IBOutlet PXPlaceholderView *placeholderView;
I am a bit stuck as to what has changed in iOS10 to cause this to crash
If PXPlaceholderView is a subclass of UIView, then when does it get a titleLabel property? That's your problem, in that the code is sending a titleLabel message to your instance of PXPlaceholderView, but it doesn't have a property that matches that name.
Renaming the Placeholder class fixed this issue