Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

Experimental feature parity: automatic delegate #51

Closed
zwaldowski opened this issue Dec 20, 2011 · 5 comments
Closed

Experimental feature parity: automatic delegate #51

zwaldowski opened this issue Dec 20, 2011 · 5 comments
Milestone

Comments

@zwaldowski
Copy link
Collaborator

A2BlockDelegate is wonderfully, incomparably awesome but the experimental branch needs to be in complete feature parity (not necessarily API compatible) with current BlocksKit. BlocksKit needs to "just work". The following snippet is currently valid in BlocksKit (though it's using the new API):

- (IBAction)sendMessage {
    MFMailComposeViewController *mailCompose = [MFMailComposeViewController new];
    [mailCompose setSubject:@"BlocksKit is great!"];
    mailCompose.completionBlock = ^(MFMailComposeViewController *vc, MFMailComposeResult result, NSError *err) {
        NSLog(@"Yay!");
    };
    [self presentModalViewController:mailCompose animated:YES];
}

This currently cannot be accomplished in the experimental branch without setting mailCompose.mailComposeDelegate, even if it is just to nil.

@a2
Copy link
Collaborator

a2 commented Dec 20, 2011

Even when we use [self registerDynamicDelegateNamed: @"mailComposeDelegate"]?

@zwaldowski
Copy link
Collaborator Author

Yes. Horribly-done test project. It pulls in my local BlocksKit, but just replace that with your local BlocksKit.xcodeproj.

@zwaldowski
Copy link
Collaborator Author

Solved with complete aplomb. ;-)

@nicked
Copy link

nicked commented Jan 17, 2012

I am still experiencing this issue, even with the latest (1.0.4).

If I have a MFMailComposeViewController with a completionBlock but no mailComposeDelegate set, the mail compose view refuses to dismiss when I cancel it.

However, when I set the mailComposeDelegate to nil, it dismisses correctly.

Note that I am not calling dismissModalViewControllerAnimated in my completionBlock, because BlocksKit is supposed to handle that.

Cheers,
Nick

@klaas
Copy link

klaas commented Jun 1, 2012

Same here, the following code works only, if I set the mailComposeDelegate to nil:

    MFMailComposeViewController *vc = [[MFMailComposeViewController alloc]init];
    vc.mailComposeDelegate = nil; // do not remove!
    [vc setSubject:@"Eversong"];
    [vc setMessageBody:@"my body text" isHTML:NO];
    [vc setCompletionBlock:^(MFMailComposeViewController *vc_, MFMailComposeResult result_, NSError *error_) {
        NSLog(@"completed");
    }];

    [self presentModalViewController:vc animated:YES];

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants