Búsqueda inteligente y reemplazo en Xcode

I created a preprocessor symbol in Xcode that releases a variable and sets it to nil like this:

#define ReleaseAndSetToNil(x) [x release]; x = nil;

However now that I want to ARC my project, this macro is problematic. Therefore, I'd like to replace all occurrences of the macro in my project (hundreds) to corresponding release and nil statements. Is there a way I can do this in Xcode?

Basically , I'd like to search for:

ReleaseAndSetToNil(whatever)

... and replace it with:

[whatever release]; 
whatever = nil;

Is there a script I can use for this?

preguntado el 03 de mayo de 12 a las 17:05

you can try viewing preprocessed code for files in question. You'd see ReleaseAndSetToNil(x) reemplazadas con [x release]; x = nil; -

1 Respuestas

If you are converting to ARC, why don't you just modify the macro to #define ReleaseAndSetToNil(x) x = nil;?

In your existing code, after switching to ARC, this will be essentially the same.

contestado el 03 de mayo de 12 a las 18:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.