• 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: [FIXED] calling scrollPoint: on table view from separate thread locks up app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FIXED] calling scrollPoint: on table view from separate thread locks up app


  • Subject: Re: [FIXED] calling scrollPoint: on table view from separate thread locks up app
  • From: "Chase" <email@hidden>
  • Date: Fri, 10 Aug 2007 15:40:46 +0000


usually when i post code to lists/forums, i change variable names, method names, etc...


i can assure you that the GM release of this application will not be posting an @"ANIMALCRACKERS" notification.

all of the points you mentioned are well-understood.

- chase









On August 9, 2007, Alastair Houghton wrote:

On 9 Aug 2007, at 22:11, Chase wrote:

in case someone 10 years from now is searching through the list archives for an answer to this question, here's what i did...

in init:

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(testnotificationreceiver:) name:@"ANIMALCRACKERS" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately] ;


in thread:

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"ANIMALCRACKERS" object:nil userInfo:nil deliverImmediately:YES];

That's almost spectacularly baroque :-)

What was wrong with

   [myObject performSelectorOnMainThread:@selector(doSomeScrolling:)
                              withObject:nil
                           waitUntilDone:NO];

?

Also, I know this was just a test, but consider using capitalisation at word boundaries in method names (like the framework does)... it's more readable and others will thank you for it. And if you're using NSDistributedNotificationCenter, you should remember that you're going to send your notification to *every* other task on the system (at least, any that are listening), so it's important that your notification name is suitably unique. I would suggest that "ANIMALCRACKERS" probably isn't such a great idea in that regard.

Anyway, don't use NSDistributedNotificationCenter for inter-thread communication. Just use the -performSelectorOnMainThread: method I showed above. It's simpler and there's no chance of conflicts with other applications.

Kind regards,

Alastair.

--
http://alastairs-place.net





_______________________________________________

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


  • Prev by Date: Re: Compile warnings according to method order
  • Next by Date: Re: Cocoa and PICT
  • Previous by thread: Re: [FIXED] calling scrollPoint: on table view from separate thread locks up app
  • Next by thread: NSTableView and keyPath
  • Index(es):
    • Date
    • Thread