Swift ViewController does not respond to -getFile, Could not connect action, target class - swift

My code works all fine but there is always two console message every time I run it.
app works fine but the messages just bugs me so much. Could anyone tell me what is wrong with my code and what does these console message means,thanks
2016-06-13 14:31:15.014
LazyHackintoshGenerator[1625:37250] Could not connect action, target class
LazyHackintoshGenerator.ViewController does not respond to -getFile:

Select your ViewController.
Right-click on its “View Controller” icon (the blue circle with a white square inside).
Look for warning icons (yellow triangles).
Hover over them. An explanation of the problem will appear.
As Feldur said, the problem is probably a leftover link from your storyboard to a method that does not exist anymore (maybe you renamed it or deleted it manually). Remove the link by clicking on the cross, and, if needed, re-link to the appropriate method in your code.
Here is an example of what it will look like in Interface Builder.

Likely a control's action in your storyboard is linked to a method getfile that no longer exists

Related

How to check which class/UIViewController is executing while testing on device on Xcode?

Recently I have been working on an old swift project built in back in 2015. Its really difficult to find which ViewController is executing currently because of the naming convention, usage of really massive storyboard(I feel terrified to even go to the main.storyboard) and various reason like usage of different language. Of course I can find it but it takes long. I was thinking if there is any way like when I run the project on a device and navigate to different page is there any way to see in the console which ViewController is executing ?
There is a quick way to find what view controller you are on when you are running your app.
1) Launch your app on the device or simulator.
2) Go into Xcode and tap this button:
3) This will open the Debug View Hierarchy. Click on the phone and you will see all the elements in the top bar. You can also see a hierarchy on the left-hand side. In here, you can click down and you will see the name of the view controller on screen.
Using the debugger after putting a breakpoint where you prefer you can write this and press return.
Swift 4.x
po UIApplication.shared.keyWindow?.rootViewController?.value(forKey: "_printHierarchy")
This method is a private API, thus you cannot use on production code, just use it in debug or from the debugger console.
I think it is better to see in debug area for your current viewcontroller named self, you get all information from there open the dropdown and and see you need to put break point in your viewController init method or where you want to debug, However you want to know programatically which is you current viewController you can get it by
appDelegate.window.currentViewController()
If you need which ViewController is Pushed or presented you can get from the above code but the case will be different if you are using the Slidemenu controller, I mean it is totally depends on how you have started navigation and which navigation controller is currently is use.
Can you briefly describe why you need current ViewController so i can help you further.

strange methods showing in First Responder received actions

I am curious about something that I am seeing in interface builder when I right click on the "First Responder" placemark. My question is when I right click the "First Responder" lists its received actions, amongst theses are 5 methods that are defined in one of my early classes, does anyone know why they are showing up, does it matter, is this normal?
EDIT:
If I right click on [First Responder] on any of the nib/xib files in my project (there are 4) I see the following.
I am just curious why the buttonPressed_XXX methods display in that list (for all the xibs in the project).
http://i.stack.imgur.com/WBMsk.png
First reponder is action of Keyboard to go off after you finish typing.. in above image all these actions uses keyboard so it shows that page when you remove the action(IBAction) thats it...
Did you delete the references from IB? XCode doesn't automatically delete the IBOutlets or IBActions if you hook up objects and get rid of the objects or IBActions. Press x beside the name of the object and the object type to get rid of the IBAction or Outlet. A picture could be helpful.

UISearchBar error when entering Searchbar textbox

I have found a strange error. I have been following this sample:
http://jduff.github.com/2010/03/09/throwing-a-uinavigationcontroller-uitabbarcontroller-and-uisearchbar-together/
I tested it and then tried to roll it in my app. It worked in the sample but not my app. In my app I would SIGABRT or BAD_ACCESS errors whenever I entered the textview inside the searchbar. The main difference was that I placed the Search on the second tab rather than the first. When I changed the taborder on my app to have the search on the first tab's navigation controller, it worked! It seems that unless I first enter the searchbar's textview. The object gets released and if I try to enter it later it fails. Very weird. I don't know enough about the objects here to say what the initialization sequence is but my guess is I need to do more initialization to get it to work.
go through the article in the link once more. especially through the "Setting up the Project" part.
In the article everything is set for the "selected view controller" which is the first one. And you say you implement everything to the second tab. Make sure you didn't implement everything in the first one of your project.
Let me know if this helps. If not I'll figure out something else.

Interface Builder shows old Received Actions

When I open my xib file in Interface Builder and click on File's Owner in the Document window, the Connections Inspector is showing far more actions below Received Actions than I have defined in the class as specified by the File's Owner Class Identity.
I have only two IBAction items defined in the class, and both of these actions are shown and hooked up to the appropriate buttons. I am not sure where these other ones are defined, as when I search the project for the text of the action shown, it is not found anywhere in my project. (I believe that the actions shown are from a previous software application that I did on this same computer.)
I cannot find any way to get rid of these, and while the application still works as it should, I would like to try to find a way to get these actions out of there.
I am using the most recently released iOS SDK 4.1.
You may need to just edit the xib file by hand and remove the invalid actions.

Console won't print, only "...unrecognized selector sent to instance 0x####XX0" Runtime Errors

I'm working on an iPhone app (first real programming project) and I had two views that would go into tabs in separate applications to build them, where they work fine. Then I added them back into the main project; The tableviews bring on a crash with an numberOfRowsInSection] unrecognized selector sent to instance 0xXXXXXX so I isolated the other view to fix any errors there first. I'm using xibs.
But on the other view, when I click a Button that triggers a custom method, I get an *** -[UIViewController methodName]: unrecognized selector sent to instance 0x####XX0 just like the last one.
What also puzzles me is that the console won't print anything else except these errors; I have NSLogs() all over the place and they're not showing up, even in the appDelegate. They do however show up when they're in the main. (Because of the application life-cycle right?: then the error gets there first and I don't see my NSLogs)
The unrecognized selector messages are logged because of methods. I have all my synthesize statements and have searched questions here, but they're not like mine (I think.)
When you say you added the XIB files "back into the main project" it makes me think this is the likely area of concern.
I think it may be the case that these XIB files are still thinking they are classes in the old application (where you originally built them). I suggest:
Opening up each XIB file and removing all the connections
Then check the class name of the "file's owner" and check that this is the class in your new application. If the class names are the same in the old app as the new, change to something else and then back again.
Hopefully this will sort it. If it doesn't, try creating a brand new XIB file and then building it in the same way as you built the others. If this still doesn't work the problem is in the class; if you let us know then we can come back with further ideas in this area.
Hope that helps!
I've since removed the second view from it's xib and instead put it in the main xib, with an added UIViewController object that has it's class set to my subclass. Now it's working, and I'm moving on to the next part. I think it was that I left out UIViewController in one way or another from the xibs
As stated above, almost everything being worked out now. Thanks though and silly me for posting such a question.