我是mac app开发的新手。
我在nstableview中有一组数据,我需要以.cs格式编程保存这些数据。
-(IBAction)exportInvoice:(id)sender
{
AppDelegate *appDelegate = [NSApp delegate];
NSString *tempStr = [NSString stringWithFormat:@"%@", [OrderModel getInitialOrderBITToDisplay:[appDelegate getDBPath]]];
NSArray* commaSeparatedObjects = [tempStr componentsSeparatedByString:@","];
//NSString *commaSeparatedObjects = [tempStr componentsJoinedByString:@","];
NSLog(@"%@",commaSeparatedObjects);
NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel];
[pdfSavingDialog setRequiredFileType:@"csv"];
if ( [pdfSavingDialog runModalForDirectory:nil file:nil] == NSOKButton ) {
// NSData *dataForPDF = [self exportPdfData];
NSData *dataForPDF = [NSKeyedArchiver archivedDataWithRootObject:commaSeparatedObjects];
NSLog(@"%@",dataForPDF);
[dataForPDF writeToFile:[pdfSavingDialog filename] atomically:NO];
}
}
任何人都可以帮我解决问题吗?