xcode 4.2でビデオプレーヤー、オーディオプレーヤーなどを含むiphoneアプリケーションを構築しています。基本的に問題は送信電子メール機能(フィードバック)です。私のコードはエラーなしで問題ありませんが、私がアプリを実行すると、これらの問題が発生し続けます。ユーザーが電子メールを送信するためのボタン「feeback」をクリックすると、クラッシュします。誰でも助けることができますか?MessageUI iphone sdk。互換性のないタイプから 'id <MFMailComposeViewControllerDelegate>'に割り当てます。FlipsideViewController
iが取得セマンティック問題:
1)警告:この行に[3]、互換性のない型 'FlipsideViewController *' から 'ID' に割り当てる:mailMe.mailComposeDelegate = self;
2)警告:不完全実装[ - Wincomplete-実装、3]この行で:
@implementation FlipsideViewController
は、ここに私のflipsideview.hです:
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@class FlipsideViewController;
@protocol FlipsideViewControllerDelegate
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller;
@end
@interface FlipsideViewController : UIViewController
@property (nonatomic, assign) IBOutlet id <FlipsideViewControllerDelegate,MFMailComposeViewControllerDelegate> delegate;
- (IBAction)done:(id)sender;
-(IBAction)website1:(id)sender;
-(IBAction)sentMail2:(id)sender;
@end
と私のflipsideview.m(送信されたメールボタン)
-(IBAction)sentMail2 {
MFMailComposeViewController *mailMe = [[MFMailComposeViewController alloc] init];
mailMe.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
[mailMe setToRecipients:[NSArray arrayWithObjects:@"[email protected]",nil]];
[mailMe setSubject:@"Feedback"];
[mailMe setMessageBody:@"Name:(your name)., Please type your details correctly before sending the e-mail." isHTML:NO];
[self presentModalViewController:mailMe animated:YES];
}
[mailMe release];
} - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissModalViewControllerAnimated:YES];
if (result == MFMailComposeResultSent) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message Sent!" message:@"Your message has been sent! \n Thank you for your feedback" delegate:self cancelButtonTitle:@"Okay!" otherButtonTitles:nil];
[alert show];
[alert release];
} if (result == MFMailComposeResultFailed) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message Failed" message:@"Your email has failed to send \n Please try again" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
どういう意味ですか? @interfaceの後ろに置いてみましたが、いくつかのエラーが発生しました... –
私は1つのエラーを取り除きましたが、まだクラッシュしています。@interface FlipsideViewController:UIViewController @property割り当て)IBOutlet id デリゲート。 –
ちょうどそれを修正しました!それはクラッシュすることはありませんが、それはまだ私に問題を与えています。ああ、ありがとう! –