> On Jan 7, 2015, at 12:55, Sean McBride <s...@rogue-research.com> wrote:
> 
> On Wed, 7 Jan 2015 12:02:16 -0600, Ken Thomases said:
> 
>> Short answer: yes, the alert is retained.
> 
> Meaning that one must use the weak/strong dance pattern like this?

No. The weak/strong dance would only be needed if NSAlert held on to the 
completion handler for multiple calls. This is not the case here, the 
completion handler is called once and is then discarded

> NSAlert *alert = [NSAlert new];
> alert.alertStyle = NSWarningAlertStyle;
> alert.messageText =  @“Do not touch!";
> __weak NSAlert* weakAlert = alert;
> [alert beginSheetModalForWindow:self.window 
> completionHandler:^(NSModalResponse returnCode) {
> NSAlert *strongAlert = weakAlert;
>       [strongAlert orderOut:self];
> }];
> 
> I miss garbage collection.  None of that was necessary.  I still haven't got 
> my head around dealing with this under ARC...


-- 
Clark Smith Cox III
clarkc...@gmail.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

Reply via email to