ios - How to keep an __autoreleasing address as a strong property in a class? -
How do I create a strong asset for a variable in a NSObject
? I have a class named SCPFMessageThreadQuery
which is allocated by passing the address of a SCPFMessageThread
variable.
@interface SCPFMessageThreadQuery () / / This declaration seems right. @property (nanatomic) scripfiles and rhythm * __ strong * thread; - (id) initWithRootMessage: (SCPFMessage *) Root thread address: (SCPFMessageThread **) address; @end @implementation SCPFMessageThreadQuery // In any way, during the autocomplete, in any way, type of ownership __autoreleasing. - (id) initWithRootMessage: (SCPFMessage *) Root thread address: (SCPF message press * __ autorelizing *) Address {if (self = [super init]) {_root = root; // Here the error complains about changing the ownership of the Xcode address _thread = address; } Healthy return; } @end
The error I am getting is:
'SCPFMMGetTrade * __ Autoreliving *' from 'SCPFMMSGetStread * __Secondant * Pointer Release Properties
I am planning to use this class with my Visual Controller as follows:
SCPFMessageThread * thread = self.thread; // self Can not thread the SCPF message press * query = [[SCPFMASETTREADread alloc] initWithRootMessage: self.rootMessage threadAddress: & thread];
I really have to pass here to know. To complete the information for an object ( SCPFMessageThread
) in the code of the app, I will make several calls to our API. Please do not ask me why the API does not JOIN instead of itself.
Problem showing this:
@ interface (appended) @ Property NSSTING * __strop * ivar; @end @implementation AppDelegate - (zero) Store Interactive: (NSString * __autoreleasing *) equals {id xpar = * par; _ivar = & amp; Xper; } @end
With dereference you are an indicator for a pertinent object only (and not "pointer to pointer in a reactant object") ARC subject is. Therefore, the object xpar
is retained - and is issued at the end of the method.
Of course you can put xpar
in a property. But it makes it clear that the whole code is useless: in the ARC, duplicate misconduct will be lost. ARC cares about the objects behind an indicator, if it is a constant object, your pointer points to the pointer, which is not a retinal object.
I do not think this is a simple solution. (Although you can use CFRetain ()
et al. If you do not care for more or less theoretical CFRetain ()
CF object problem.) < / P>
Even you have explicitly confirmed this: Why do you need an extra layer of indirect? If you really need it, in fact, think about an additional object in between:
@interface NSStringRetainableReference @property NSString * string; @end @implementation @end
Pass an example object of this class in the form of argument. Then you have an indicator for a reputable object and there is an objection at the other level. But in this case it is made from an object.
Comments
Post a Comment