如何在SKPSMTPMessage中发送变量字符串



我需要发送一个变量字符串作为消息。我使用sktpsmtpmessage将食品订单从我的应用程序发送到面包店。帮助吗?下面是我的代码:

NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
                            @"string goes here",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];    
NSDictionary *plainPart = 
      [NSDictionary dictionaryWithObjectsAndKeys:
@"text/plain",
kSKPSMTPPartContentTypeKey, 
[NSString stringWithFormat:@"string goes here%@",yourVaraibleName],   
kSKPSMTPPartMessageKey,@"8bit",
kSKPSMTPPartContentTransferEncodingKey,nil]; 

注意stringWithFormat调用。你可以完全替换你的变量string通过删除文本'string goes here'(忽略引号)。

最新更新