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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top