• 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: Correct way to use contextInfo with ARC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct way to use contextInfo with ARC


  • Subject: Re: Correct way to use contextInfo with ARC
  • From: Ron Hunsinger <email@hidden>
  • Date: Thu, 04 Aug 2011 16:07:44 -0700

On Aug 3, 2011, at 6:38 PM, Kevin Bracey wrote:

> NSMutableArray *someInfo = [NSArray arrayWithObjects:@"made" , @"it", @"across",. nil];

Did you really want to create an NSArray (non-mutable) and then pass it off as an NSMutableArray? Since you mentioned ARC, I'm surprised the compiler didn't flag the type mismatch. You might have better luck creating the NSMutableArray that your completion routine seems to be expecting:

	NSMutableArray *someInfo = [NSMutableArray arrayWithObjects:@"made" , @"it", @"across",. nil];

	[holdAlert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(
		alertDidEnd:returnCode:contextInfo: ) contextInfo:someInfo;


	-(void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode  contextInfo:(void  *)contextInfo
	{
		NSMutableArray *holdArray = (NSMutableArray*)contextInfo;
		...
	}

Or, if the array doesn't really need to be mutable, use NSArray throughout. The only reason to make it mutable would be so the completion handler could use it to pass information back, but of course it has the delegate itself for that.

Or, use a block. That might be simpler still._______________________________________________

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: 
 >Correct way to use contextInfo with ARC (From: Kevin Bracey <email@hidden>)

  • Prev by Date: Core Data Concurrency Issues
  • Next by Date: Re: Core Data Concurrency Issues
  • Previous by thread: Re: Correct way to use contextInfo with ARC
  • Next by thread: How to Identify if the device is used in iAD supported Regions
  • Index(es):
    • Date
    • Thread