I have some variables, which cache some data from a webservice.
To make my code more dynamic, I want to return a double pointer to the cache-variable. So it's a double pointer. I have some issues doing this with ARC.
Here's what I got:
- (id *)pointerToSectionCacheProperty:(SomeSection)section {
switch (section) {
case Section1:
{
return &_section1Cache;
}
break;
case Section2:
{
return &_section2Cache;
}
break;
case Section3:
{
return &_section3Cache;
}
break;
}
return nil;
}
ARC gives me the following error:
Returning 'NSArray *__strong *' from a function with result type '__autoreleasing id *' changes retain/release properties of pointer
Is this the wrong approach?
If so, what is the right approach?