Pergunta

I have method that takes indirect pointer as argument and then, if error, set it to error object. I'm trying to turn on as many warning as possible. But one of them - Implicit ownership types on out parameters - generates warning in this method:

- (id)doWithError:(NSError **)error {
    ...
}

How can I fix code to remove warning?

Foi útil?

Solução

You can fix that warning by declaring your method as

- (id)doWithError:(NSError * __autoreleasing *)error {
    // ...
}

The __autoreleasing ownership qualifier is implicitly assumed for "out-parameters" (see "4.4.2 Indirect parameters" in the Clang/ARC documentation), therefore adding it explicitly does not change the code.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top