In an attempt to compile my iOS build, I get this error message. Anyone seen this before?
No known instance method for selector.
It means a selector sent to an object cannot be handled because the object (or its super) doesn't have corresponding methods, and the message forwarding process failed to handle it. You should check your code according to the error message and make sure the callings are correct.
Related
I just want to add a warning or error message on a inbuilt swift method print(), If someone uses print() method anywhere in my project i want to show them a compiler warning or error. (like please don't use print method, use someOther Method instead).
Is it possible ?
Please help.
I've been debugging for several hours, read some articles but still can't find what's wrong.
I've switched on ARC, but I found that my BIDGameScence will be deallocated strangely, and I don't know why.(I've checked that all pointer to BIDGameScene is strong.) I went through call stack when selector dealloc was called, but there's no selector written by myself in the stack(I think the last stack frame is a function used to send a message).
I also tried Zombies, but I just got Message send to deallocated object. An article says that I should use malloc_info, but I'm using lldb and got malloc_info is not a valid command.(I found that there is no gdb in my XCode.)
What's more, I added a NSLog statement in applicationDidReceiveMemoryWarning, but I did't find it in the logging.
Finally I tried to use Product->Analyze, but got nothing.
So, how to debug this error?
I'm using XCode 4.
In my app, Thread 13 is marked as:
com.apple.root.default-overcommit-priority
Right below I see a:
0 __forwarding__
and below I have a:
6 _pthread_wqthread
Which causes:
-[CFString release]: message sent to deallocated instance
I understand that a message is being sent to a deallocated instance, my problem is I cannot find where that happens.
I have zombies enabled, exception logging, etc.
I have also created a framework which is imported (with full debug symbols), and I have a feeling that this is where the error originates from.
Since the framework is not executable directly, and has to be imported, how can I debug/step into it, etc, in order to try and find the exact line that triggers this problem?
Further more, How can I get more info about the crash, other than the assembly/stack/register info?
These lldb extensions are incredibly helpful for debugging. In your case, the bmessage command will allow you to set a breakpoint on [CFString release] so that you can get the trace and track down where release is being called twice on the same object.
https://github.com/facebook/chisel
All,
I have a chunk of code that runs over a lot of records and in about half of the cases fails (this is ok, some records simply don't have the required data) I put this code in a #try #catch block to make it run smoothly, we try to do our thing, if we fail, we have some default action.
When it fails in the #try block often it is a unrecognized selector error, since it is in the #try block I catch this error, but it still gets logged everytime, even when I don't log from my #catch block. This is very annoying because it clogs up my logging. If I want errors from a #try/#catch logged, I will take care of that in the #catch right?
How can I stop XCode from logging errors in the #try block that are subsequently resolved in the #catch block?
I am using XCode 4.2
Thanks
In Objective-C using exceptions for any normal situation that can appear in a program is a no go. Exceptions are used only for discovering and catching programming errors and terminating gracefully. The problem is that all of the standard libraries (Cocoa, CoreFoundation, C standard library, ...) just are not build to handle exceptions and would fail to clean up resources if exceptions went through them.
Theoretically you could use exceptions if you made sure that you do your memory and other cleanup correctly and do not throw through foreign code. If you use ARC, there's a compiler switch -fobjc-arc-exceptions that would help you to get memory management (in your code) right.
Common practice is not to use exceptions at all (other than bugs, for example using NSAssert).
Exceptions themselves do not log any message to the console. Neither does Xcode (by default) log any exception throwing.
It's the error catching code that writes the messages before throwing exceptions. NSObject's doesNotRecognizeSelector: prints a message when unrecognized selectors are being sent. You cannot turn this off.
So you want to see certain log message but not others. How about redirecting the debugger output into a file. On that file use grep or a text editor with nice filtering to scan through message you want to see. Copy & paste from the gdb console into an edtor would do the same trick.
My app crashes with this (after the end of viewDidLoad):
-[NSPathStore2 release]: message sent to deallocated instance
A similar issue was reported in this question, but I'm not using any explicit NSPathStore2 instances, so I don't know where this is coming from. I know this is a memory-related issue, but I'm not sure how to track it down
What could be causing this overreleased NSPathStore2? What is an NSPathStore2?
NSPathStore2 is an internal object used by NSString for path work. You're almost certainly overreleasing an NSString somewhere in your code. The static analyzer will probably show you where: assuming you're using Xcode 4, choose Analyze from the Product menu.