Automatic Reference Counting Issue: Passing address of non-local object to __autoreleasing parameter for write-back

前端 未结 1 1551
失恋的感觉
失恋的感觉 2020-12-09 10:42

I\'m trying to pass pointer to pointer to a method, but apparently ARC has some issues with how I\'m doing it. Here the two methods:

+ (NSString *)personProp         


        
相关标签:
1条回答
  • 2020-12-09 11:21

    The __strong storage qualifier is needed for this case.

    + (void)SHL_initPersonPropertyNamesWithArray:(NSArray * __strong *)theArray
    

    However, this code doesn't follow the Basic Memory Management Rules.

    You own any object you create

    You create an object using a method whose name begins with “alloc”, “new”, “copy”, or “mutableCopy” (for example, alloc, newObject, or mutableCopy).

    For what reason do you want to do this?

    0 讨论(0)
提交回复
热议问题