-1
我的錯誤它「WHMailActivity」不可見@interface聲明選擇「activityDidFinish:」爲「WHMailActivity」不可見@interface聲明選擇「activityDidFinish:」
,我收到了一個晚上,但我沒有成功。 。 。爲什麼在其他地方如此使用,但我不能。 。 。 我希望能幫助我。 。 。
在此先感謝!
這一點,我的.h
#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
#import "WHMailActivityItem.h"
@interface WHMailActivity : UIViewController
@end
,這是我的.m
#import "WHMailActivity.h"
@interface WHMailActivity() <MFMailComposeViewControllerDelegate>
@property (nonatomic, strong)WHMailActivityItem *activityItem;
@end
@implementation WHMailActivity
#pragma mark - UIActivity Overrides
- (NSString *)activityType {
return NSStringFromClass([self class]);
}
- (NSString *)activityTitle {
return NSLocalizedString(@"Mail", @"title for Mail activity item");
}
- (UIImage *)activityImage {
return [UIImage imageNamed:@"mailActivity.png"];
}
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems {
if (![MFMailComposeViewController canSendMail]) {
return NO;
}
for (id item in activityItems) {
if ([item isKindOfClass:[WHMailActivityItem class]]) {
return YES;
}
}
return NO;
}
- (void)prepareWithActivityItems:(NSArray *)activityItems {
for (id item in activityItems) {
if ([item isKindOfClass:[WHMailActivityItem class]]){
self.activityItem = item;
}
}
}
- (UIViewController *)activityViewController {
MFMailComposeViewController *composeController = [[MFMailComposeViewController alloc] init];
if (self.activityItem.onMailActivitySelected) {
self.activityItem.onMailActivitySelected(composeController);
}
composeController.mailComposeDelegate = self;
return composeController;
[self performSelector:@selector(mailComposeController)];
}
#pragma mark - MFMailComposeViewControllerDelegate
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[self activityDidFinish:result == MFMailComposeResultSent];
}
@end
圖片按鈕如何連接到代碼? – SoraSama