Re: viewDidLoad and KVO

2014-06-05 Thread Alejandro Visiedo García
Why don't you use viewWillAppear and viewDidDisappear, to register and 
unregister observers to your foo property object?

If you don't use ARC, be carefull to unregister on dealloc too!

> El 05/06/2014, a las 09:30, Rick Mann  escribió:
> 
> 
>> On Jun 5, 2014, at 00:26 , Lee Ann Rucker  wrote:
>> 
>> If you're doing something like this:
>> 
>> - (void)setFoo: (Foo *)aFoo
>> {
>> [foo removeObserver:self forKeyPath:@"whatever"...];
>> foo = aFoo;
>> [foo addObserver:self forKeyPath:@"whatever"...;
>> }
>> 
>> we used that pattern for a while but were constantly getting bit by 
>> observers on objects being dealloced or KVO firing and triggering unwanted 
>> side effects if we called setFoo: in dealloc. So we did a complete switch 
>> over to doing
>> 
>> [self addObserver:self forKeyPath:@"foo.whatever"...
>> 
>> in init, and removeObserver in dealloc, because you can remove an observer 
>> on yourself in dealloc without the "observers still registered" warning.
>> 
>> Since it's on self, you can set it before foo exists, and setFoo: triggers 
>> it. Plus we could use synthesized setters.
> 
> I collect the removeObserver calls into an "ignoreFoo" method, and similarly 
> the addObserver in an "observeFoo" method. Then in -dealloc I call 
> -ignoreFoo. I've never run into the (annoying) registration mismatch errors.
> 
> Your suggestion is a good one, but I don't think it solves the problem I have 
> of -setFoo: being called before -viewDidLoad (before the IBOutlets are 
> non-nil).
> 
> -- 
> Rick
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/alejandro.visiedo%40gmail.com
> 
> This email sent to alejandro.visi...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Fwd: Plugin iPhoto don't Finish!

2011-03-31 Thread Alejandro Visiedo García
Hello!

One month later! Finally i have the solution from my problem! and i upload 
photos succesful to social networks! wow!

The origin of the problem was a model dialog that i showed before run 
performExport message from my controller!

When i stop run modal loop, i called [dialog setHidden:TRUE] but i had forbiden 
to call [NSApp endSheet:dialog]

I hope this can be useful for someone with similar problems!

Bye!

Alejandro Visiedo García
web: http://devsensation.es


Inicio del mensaje reenviado:

> De: Alejandro Visiedo García 
> Fecha: 21 de febrero de 2011 01:30:11 GMT+01:00
> Para: ML Cocoa 
> Asunto: Plugin iPhoto don't Finish!
> 
> Hello!
> 
> I'm trying to develop an iPhoto Plugin to upload photos to a social network!
> 
> When i'm finished to upload all photos, i exec then next sentences at the end 
> of performExport:
> 
>   [self lockProgress];
>   mProgress.message = nil;
>   mProgress.currentItem = count;
>   mProgress.shouldStop = YES;
>   [self unlockProgress];
> 
> However, the progress window don't close!
> 
> any idea why don't close the progress window?? I need notify ExportMgr with 
> any message???
> 
> Thanks!
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Plugin iPhoto don't Finish!

2011-02-20 Thread Alejandro Visiedo García
Hello!

I'm trying to develop an iPhoto Plugin to upload photos to a social network!

When i'm finished to upload all photos, i exec then next sentences at the end 
of performExport:

[self lockProgress];
mProgress.message = nil;
mProgress.currentItem = count;
mProgress.shouldStop = YES;
[self unlockProgress];

However, the progress window don't close!

any idea why don't close the progress window?? I need notify ExportMgr with any 
message???

Thanks!

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com