• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems converting to ARC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems converting to ARC


  • Subject: Re: Problems converting to ARC
  • From: Christ Levesque <email@hidden>
  • Date: Sat, 20 Apr 2013 08:19:47 -0700

>> 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.
I used __strong and it'a ok now.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: Problems converting to ARC (From: Ken Thomases <email@hidden>)

  • Prev by Date: UIAppearance for iOS provided view controllers
  • Next by Date: Re: Problems converting to ARC
  • Previous by thread: Re: Problems converting to ARC
  • Next by thread: Re: Problems converting to ARC
  • Index(es):
    • Date
    • Thread