1

Whenever I am passing an argument of Objective C type A to my function then everything is alright:

- (void) f:(id<A>)argument 

However, when it's an array of the same object type, Xcode requires that I add a strong attribute as:

- (void) f:(__strong id<A> [])argument 

Any idea why is that?

4
  • (1) What does Xcode say? (2) What's your definition of A, is it a protocol? Commented Dec 14, 2017 at 2:43
  • Yes, A is a protocol. I don't think A makes any difference here. The distinction is between having an object vs. having a C array of objects. Commented Dec 14, 2017 at 17:06
  • 1
    Possible duplicate of ARC - why do object pointers require explicit ownership type in function definitions? Commented Dec 15, 2017 at 6:03
  • @blld Agree, it seems a duplicate; however, the answer there is not satisfying. Commented Dec 15, 2017 at 17:29

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.