Was sind die häufigsten / ungewöhnliche Fehlermeldungen begegnet man in Objective-C und was sie verursacht?

StackOverflow https://stackoverflow.com/questions/4728306

Frage

Ich habe versucht, eine Liste aller Fehlermeldungen zu erhalten mir jemals begegnen, während der Entwicklung und die gemeinsamen Ursachen und Fehlerbehebung. Was sind die gemeinsamen (und die nicht so häufig) Fehlermeldungen auftreten und wie hast du sie zu beheben?

War es hilfreich?

Lösung

EXC_BAD_ACCESS when referencing a pointer that points to an object that has been dealloc'ed

Andere Tipps

In general I find objective-c exception and error messages tO be self-explanatory. I think you would be better served by learning to use the debugger with breakpoints on objective-c exceptions to locate the specific line causing a crash than by trying to compile a list of recipies for resolving common errors.

That said the one non-obvious error I see as a frequent point of confusion is "unrecognized selector foo: sent to BarClass". While the reason why that is an error should be clear answering how that happened can be harder and I see two common causes:

  1. An app is attempting to call a subclass' method on an instance of a super class. Often a result of developers failing to change the class of objects in IB.
  2. An object has been over-released or otherwise referenced after being deallocated. If a new instance of some other class now occupies that memory address the app with hit an "unrecognized selector" exception rather than a "BAD_ACCESS".
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top