这是我的 NSObject 代码;
任务.h
#import <Foundation/Foundation.h>
@interface Task : NSObject
@property (nonatomic,strong) NSString *name;
@property (nonatomic,assign) BOOL done;
-(id)initWithName:(NSString *)name done:(BOOL)done;
@end
任务.m
#import "Task.h"
@implementation Task
@synthesize name = _name;
@synthesize done = _done;
-(id)initWithName:(NSString *)name done:(BOOL)done {
self = [super init];
if (self) {
self.name = name;
self.done = done;
}
return self;
}
这是我的发送邮件代码
Task *task = [[Task alloc]init];
MFMailComposeViewController *sendmail = [[MFMailComposeViewController alloc]init];
[sendmail setMailComposeDelegate:self];
NSString *message = [_tasks addObject:task]; // Error is here.
[sendmail setMessageBody:message isHTML:NO];
[sendmail setSubject:@"Test"];
[self presentViewController:sendmail animated:YES completion:nil];
我不知道,该怎么做。我只想用邮件发送列表。我的错误在哪里?我该如何解决这个问题?
任务列表视图控制器.m
@synthesize tasks = _tasks;
我正在从任务表视图转移。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *NotDoneCellIdentifier = @"NotDoneTaskCell";
static NSString *DoneCellIdentifier = @"DoneTaskCell";
Task *currentTask = [self.tasks objectAtIndex:indexPath.row];
NSString *cellIdentifier = currentTask.done ? DoneCellIdentifier : NotDoneCellIdentifier;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
// Configure the cell...
cell.textLabel.text = currentTask.name;
return cell;
}