Re: Core Data: Progress bar using Sheet, modifying context in thread
Re: Core Data: Progress bar using Sheet, modifying context in thread
- Subject: Re: Core Data: Progress bar using Sheet, modifying context in thread
- From: Jakob Olesen <email@hidden>
- Date: Sat, 5 Aug 2006 02:52:56 +0200
On 05/08/2006, at 1.46, Bill Coleman wrote:
When you set "Automatically prepares content", the controller
observer notifications from the NSManagedObjectContext.
I looked at this, and the documentation says "Returns a Boolean
value that indicates whether the receiver automatically prepares
its content when it is loaded from a nib."
Now, my NSArrayController was loaded from a nib when the document
was created or opened. Is the documentation just very misleading here?
The documentation is correct, what I said was speculation. Frankly, I
don't know when a controller reacts to notifications and when it
doesn't.
You can get the run loop to call you back using [self
performSelector:afterDelay:] or NSNotificationQueue. This is
cooperative multitasking.
Ugh! I did this for years under MacOS 9....
Yeah, well. Did you get random exceptions back then? :-)
There is no free lunch when doing multiprocessing. You can use a
thread and deal with the issues, or you can use cooperative
multitasking and deal with some other issues. There is no magic
trouble-free way.
Generally, the single-threaded option is easier. Especially when Core
Data is involved.
Always use -[performSelectorOnMainThread:] to send messages back,
even for the NSProgressIndicator.
I tried this with the progress indicator, but the progress wouldn't
update. I'll try again.
Let me guess:
[progressBar performSelectorOnMainThread:@selector(setDoubleValue:)
withObject:[NSNumber mumble] waitUntilDone:NO];
You can't call -[setDoubleValue:] like that since it takes a double
argument, not an object. The result is a double composed of 32 bits
of pointer and 32 bits of garbage.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden