Objective c Phonegap EmailComposer插件错误

Objective c Phonegap EmailComposer插件错误,objective-c,plugins,cordova,Objective C,Plugins,Cordova,当我尝试从Xcode构建时,出现以下错误()。我不熟悉Obj-C,所以我不确定这是因为我犯了一个错误,还是因为插件过时了。我使用的是Phonegap(3?)的最新版本&Xcode 4.6.3 EmailComposer.m:132:6:“发布”不可用:在自动引用计数模式下不可用 EmailComposer.m:132:6:ARC禁止发送“release”的明确消息 EmailComposer.m:175:21:将Objective-C指针类型“NSString*”转换为C指针类型“CFStri

当我尝试从Xcode构建时,出现以下错误()。我不熟悉Obj-C,所以我不确定这是因为我犯了一个错误,还是因为插件过时了。我使用的是Phonegap(3?)的最新版本&Xcode 4.6.3

  • EmailComposer.m:132:6:“发布”不可用:在自动引用计数模式下不可用
  • EmailComposer.m:132:6:ARC禁止发送“release”的明确消息
  • EmailComposer.m:175:21:将Objective-C指针类型“NSString*”转换为C指针类型“CFStringRef”(又名“const struct”u CFString*)需要桥接转换
  • EmailComposer.m:179:11:将C指针类型“CFStringRef”(又名“const struct u CFString*”)转换为Objective-C指针类型“NSString*”需要桥接转换
像这样试试

我在cordova-2.7.0和xcode 4.6中使用了以下插件文件。这对我来说很好

将插件文件名作为EmailComposer,并将以下代码复制到EmailComposer.h文件中

#import <MessageUI/MFMailComposeViewController.h>
#import <Cordova/CDVPlugin.h>
@interface EmailComposer : CDVPlugin < MFMailComposeViewControllerDelegate > {    
}

- (void) showEmailComposer:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

- (void) openApplication:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

@end

我猜这个插件还没有被修改以支持PhoneGap3.0。我想它附近的支持将是PhoneGap2.6.0。
#import "EmailComposer.h"
@implementation EmailComposer

- (void) openApplication:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",[arguments objectAtIndex:1]]]];
}

- (void) showEmailComposer:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{   
// NSUInteger argc = [arguments count];

NSString* toRecipientsString = [arguments objectAtIndex:1];//[options valueForKey:@"toRecipienthellos"];
NSString* ccRecipientsString = [options valueForKey:@"ccRecipients"];
NSString* bccRecipientsString = [options valueForKey:@"bccRecipients"];
NSString* subject = [options valueForKey:@"subject"];
NSString* body = [options valueForKey:@"body"];
NSString* isHTML = [options valueForKey:@"bIsHTML"];

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

// Set subject
if(subject != nil)
    [picker setSubject:subject];
// set body
if(body != nil)
{
    if(isHTML != nil && [isHTML boolValue])
    {
        [picker setMessageBody:body isHTML:YES];
    }
    else
    {
        [picker setMessageBody:body isHTML:NO];
    }
}

// Set recipients
if(toRecipientsString != nil)
{
    [picker setToRecipients:[ toRecipientsString componentsSeparatedByString:@","]];
}
if(ccRecipientsString != nil)
{
    [picker setCcRecipients:[ ccRecipientsString componentsSeparatedByString:@","]]; 
}
if(bccRecipientsString != nil)
{
    [picker setBccRecipients:[ bccRecipientsString componentsSeparatedByString:@","]];
}

if (picker != nil) {    
    [self.viewController presentModalViewController:picker animated:YES];
}
[picker release];
}

// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{   
// Notifies users about errors associated with the interface
int webviewResult = 0;

switch (result)
{
    case MFMailComposeResultCancelled:
        webviewResult = 0;
        break;
    case MFMailComposeResultSaved:
        webviewResult = 1;
        break;
    case MFMailComposeResultSent:
        webviewResult =2;
        break;
    case MFMailComposeResultFailed:
        webviewResult = 3;
        break;
    default:
        webviewResult = 4;
        break;
}

[self.viewController dismissModalViewControllerAnimated:YES];

NSString* jsString = [[NSString alloc] initWithFormat:@"window.plugins.emailComposer._didFinishWithResult(%d);",webviewResult];
[self writeJavascript:jsString];
[jsString release];

 }

 @end