I'm trying to clean up some old code that I wrote to comply with Apple's guidelines on method naming etc. and encountered this. Basically, I have a button in Interface builder and a tapDown action connected to an event handler in my implementation file. I've changed the name of this event handler via the refactor tool built into Xcode. The name of the method is updated in the .h / .m files and in the IB GUI. I've also looked at the raw xml .xib file and there's no trace of my old method name.
When I click on the button however, I get an error saying unrecognized selector oldMethodName:.
The error shows that something is still trying to call my older method, but I'm not sure what it is. What else can it be?
Thanks,
Teja.
Damn, figured it out a second after posting this question. The app on the simulator wasn't getting updated for some reason. Did a 'Reset content and settings' on the simulator and it works now.
Related
I already asked this in the Apple Dev Forum but received no replies, so I'll try here.
I'm unsure if this is a bug or whether I've missed something since I'm still very new to programming.
I have multiple view controllers and have made multiple classes. I have set the custom class "bit" of each view controller to the revelent class. When I ctrl-drag anything from the view to the relevent class header, I get the usual pop-up. I fill in the info, press connect, and BAM. It does the same kind of error whether I choose "Outlet" or "Action" It worked in the previous Xcode but I'm not sure if I've forgotten something.
The view controller and class that I added with Xcode 4 is still working beatifully.
I've tried adding the image manually but all that gave me was a SIGBART error just trying to get to the view. Again, I may have missed something, but I don't think there's much to miss is there?
Any help would be appreciated.
Just to eliminate a few things... I've deleted derived data, restarted Xcode and done a "clean". That's all I can remember that I've done.
Problem solved:
When selecting the implementation file. When I looked in the File Inspector, I found that under "Target Membership", the app name wasn't ticked. I ticked it and it now works well.
Since I didn't need to do that in Xcode 4, I suspect in Xcode 5, it doesn't do that automatically. Maybe that's a bug? I don't know if it was deliberate by Apple, but I think I'll file a bug report anyway since It's a bit of a nuisance.
Is it possible to access the properties of objects in xCode console?
If I try the following I get an error that he property doesn't exist.
po someObject.someprop
If I don't breakpoint the code and run the app it works fine so I know someObject.someprop exists. I don't think I have the grasp on xCode console yet? What I loved about Flex/Flash development is that I could set a break point and in the console window or variables view I could traverse every structure down to the ends of the earth.
I could see SomeDicionary[key].someArray[1].someObject.prop and it would show me the value. Is this not possible in xCode console or is there a trick to get to it?
You'll actually have to use the bracket syntax notation:
po [someObject someprop]
The debugger is sometimes very finnicky about syntax. This is filled with all sorts of helpful tips for debugging in XCode.
Just a side note, variables/properties declared in the implementation file (*.m) instead of the header file (*.h) can sometimes be invisible to the debugger variable list display depending on if the breakpoint is in that class's code, because of scope. Not necessarily required here, but useful to know seeing as how it is kind of relevant.
I have a UIViewController containing a UIWebView which I am using to view various documents. Occasionally a document may attempt to be loaded which is not supported by the UIWebView (e.g. old Excel 2.0 sheet). Currently this causes output in the debug window as follows :
exception: CPMessageException: The file format is invalid.
EXCEPTION CPMessageException: (null)
The webViewDidStartLoad method fires, but neither webViewDidFinishLoad or didFailLoadWithError fires.
The error doesn't crash the app, but I would like to trap this exception to provide my own message for the user. Can anybody suggest how to trap and handle this?
Many thanks,
Jonathan
Unfortunately CPMessageException is part of the private frameworks of Apple, in case of office files, OfficeImport.framework. This is thrown when the framework receives an unusable file.
The reason your application is not crashing is because it is probably being handled in the import code itself. Even setting NSSetUncaughtExceptionHandler will not work (as I have tried in the past).
The best way to go around this would be to use the shouldStartLoadWithRequest delegate method of UIWebView:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Here you could preemptively stop the file from being loaded into the web view and avoid a clueless blank screen.
(Am not sure if there is a way to read NSLog output on the fly so you could monitor it. But that is probably not a right way to do it!)
Update: Just filed a bug regarding this. Let us see what the Apple Developers have to say on this.
I am using core plot and I am getting an error
"'*** -[UIView setHostedLayer:]: unrecognized selector sent to instance 0xf283a0'"
at line
hostingView.hostedLayer = graph;
I had this problem too! I just figured out the solution: you need to open up the xib file for your view controller class, the one where you setup the pie chart, and in there you will need to select the view, then make the view a CPLayerHostingView type. If you're unsure how to do this, go to the "Identity Inspector" window, and under Class Identity (the first item in the Identity Inspector window, enter CPLayerHostingView for the "class" value. When you do this, the view will then be labelled as "Layer Hosting View". Save and close the .xib, then go back to Xcode and build. It should work at that point.
Sorry if this way is extraneous and there is a better way, but this is how I finally got it to work. Hit me up if you have any further questions or need more explanation. Good luck!
Andy
Make your View a CPTGraphHostingView. It worked for me.
I got the same error, but it was due to typecasting of UIView into CPGraphHostingView. I got the solution at this link:
Error: "-[UIView setHostedGraph:]: unrecognized selector" while executing the core plot in iPhone app
You hostingView has to be a CPLayerHostingView, not a generic UIView. Make sure it is specified correctly in Interface Builder or in your setup code if you're creating it manually.
I was upgrading to the latest version of CorePlot (as of 1-9-2012) and had this error.
-[UIView setCollapsesLayers:]: unrecognized selector sent to instance
I found that my view was still set to the old CPGraphHostingView, even though it had been replaced in the code with the new version. From the tip above, I changed the view to the new value of CPTGraphHostingView.
Notice in the new version of CorePlot the name prefixes were changed from "CP" to "CPT".
I got the warning :
property 'textField' requires method
'-textField' to be defined - use
#synthesize, #dynamic or provide a
method implementation.
Now, there is no such property defined in my project! More bizarre, if I just click save in Interface builder and build again, the build is successful - though, right on the line with '#end' the warning appears. Also weird: if I begin to write some code ..and then delete it just the way it was before writing it (maybe not code..anything) and then build&go the warning with the textField appears again. Could be a bug of sdk? What could be happening?
Go into interface builder, and click File > Read all class files. Save and quit IB. Go back into Xcode and click Build > Build & Clean. Build your project.