I'm building an iphone application which involves a video player,audio player and more in xcode 4.2 Basically the problem is the sending e-mail function(feedback). My code is fine with no errors but when i run the app it keeps giving these issues and when i click the button "feeback" for the user to sent an e-mail it crashes. Anyone can help?
the semantic issues i get:
1) warning: assigning to 'id' from incompatible type 'FlipsideViewController *' [3] in this line: mailMe.mailComposeDelegate = self;
2)warning: incomplete implementation [-Wincomplete-implementation,3] in this line:
@implementation FlipsideViewController
here's my 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
and my flipsideview.m (the sent mail button)
-(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];
}
}
Your conforming delegate marks are in the wrong place. Place them immediately after the part of your @interface that specifies a superclass