• 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
loop not running
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

loop not running


  • Subject: loop not running
  • From: Amy Heavey <email@hidden>
  • Date: Thu, 20 Jan 2011 19:48:08 +0000

I've got the following code that is almost identical to code I've got in another app. The other app works, this one doesn't. The only difference between the two is the variable names;

- (IBAction)addItemsToOrder:sender;{
	NSObject *order;
	order = [[Orders selectedObjects] objectAtIndex:0];

	NSArray *newOrderProducts;
	newOrderProducts = [Products selectedObjects];
	NSEnumerator *loop = [newOrderProducts objectEnumerator];
	NSObject *product;
	NSLog(@"Hello There!");
	//for each selected product:
	while ((product = [loop nextObject])) {
		NSLog(@"Hello There! in while loop");
		//create new kitItem
		NSManagedObject *newOrderItem = [NSEntityDescription

									   insertNewObjectForEntityForName:@"CustomerOrderItems"

									   inManagedObjectContext:managedObjectContext];

		//link new product to order
		[newOrderItem setValue:order forKey:@"customerOrderRef"];
		//link new order item to product
		[newOrderItem setValue:product forKey:@"orderItemProduct"];

	}

}


When I run this in the app, I see the first "Hello There" but nothing else in the log. There is definitely a Products order array in the interface, and it definitely has selected objects. I have table columns bound to the Products array so I can see they are selected. I've got the following in my header file as well;


	IBOutlet NSArrayController *Products;


But I just can't see why it's not going into the loop?


Many Thanks

Amy
_______________________________________________

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


  • Follow-Ups:
    • Re: loop not running
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
  • Next by Date: Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
  • Previous by thread: Re: printing a different representation than what is on the screen
  • Next by thread: Re: loop not running
  • Index(es):
    • Date
    • Thread