I’m making a application which read emails in Mail.app. Firstly, the application get all senders from Mail.app using
NSArray *emailSenders = [self.mailBox.messages arrayByApplyingSelector:@selector(sender)];
I have to display target user email content, e.g. only show all mails from “abc@gmail.com”, so I get the sender indexes which contain the target user email
[emailSenders enumerateObjectsUsingBlock:^(NSString *emailSender, NSUInteger idx, BOOL *stop) {
if([emailSender rangeOfString:userEmail].location != NSNotFound){
[emails addObject:[self.mailBox.messages objectAtIndex:idx]];
}
}];
emails is a SBElementArray created by
SBElementArray *emails = [[SBElementArray alloc]init];
I want to fetch all contents in emails by sending Apple Script Event only once, like
[mails arrayByApplyingSelector:@selector(content)];
so I create my own SBElementArray, but the problem is Xcode display:*** -[SBElementArray init]: should never be used. when I run this code, how to fix it?
Just add your filtered items to an
NSArrayorNSMutableArray, and remember that its elements areSBObjects.