>> I want to convert my code to ARC but this problems doesn't let me to do 
>> this. I read the errors but I couldn't do nothing. All the problems are in 
>> these else if statement and are colored Red.
>> 
>> else if (isupper(character)){
>>      1) Pointer to non-const type 'NSString *' with no explicit ownership
>>      NSString **classOrProtocolName = (isParsingProtocolName ? 
>>                                      &protocolName : &className);
>> 
>>      2) Passing address of non-local object to __autoreleasing parameter for 
>> write back
>>      i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), 
>>                                      classOrProtocolName);
>>      isParsingProtocolName = NO;
>> }else if (i == 0){
>>       3) Passing address of non-local object to __autoreleasing parameter 
>> for write back
>>      int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), 
>>                                      &typePrefix);
>>      if (advancement == 0)
>>              return;
>> 
>>      i += advancement;
>> }else{
>>      2) Passing address of non-local object to __autoreleasing parameter for 
>> write   back
>>      i += parseTypeSuffix(unparsedText, strlen(unparsedText), &typeSuffix);
>> }
> 
> You could rewrite the above code like this:
> 
> else if (isupper(character)){
>    NSString *classOrProtocolName;
> 
>    i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), 
>                    &classOrProtocolName);
>    if (isParsingProtocolName)
>        protocolName = classOrProtocolName;
>    else
>        className = classOrProtocolName;
>    isParsingProtocolName = NO;
> }else if (i == 0){
>    NSString* localTypePrefix;
>    int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), 
>                    &localTypePrefix);
>    typePrefix = localTypePrefix;
>    if (advancement == 0)
>        return;
> 
>    i += advancement;
> }else{
>    NSString* localTypeSuffix;
>    i += parseTypeSuffix(unparsedText, strlen(unparsedText), &localTypeSuffix);
>    typeSuffix = localTypeSuffix;
> }
> 
> Regards,
> Ken
> 

Why did you changed the source code? The aspect is correct but the problem was 
ARC that I solved all of them.
Also I tried your solution at the first time that I got stuck but ARC complains 
about it. 
I used __strong and it'a ok now.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to