ipad服务器修改主目录打不开,无法将文件从主包复制到iPad上的文档目录

我在这里找到了这篇帖子。它在iPad模拟器模式下按照预期工作,但在切换到实际的iPad设备模式时无法使用。相反,它提出了“没有这样的文件存在”的错误信息。在执行这些代码之前,我确实通过右键单击xxxxxx.app创建了一个Populator文件夹,然后选择“显示包内容”并将一些文件放入Populator文件夹。 Xcode是否将整个应用程序包复制到iPad设备上?有什么建议么?无法将文件从主包复制到iPad上的文档目录

NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Populator"];

NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Files"];

NSLog(@"Source Path: %@\n Documents Path: %@ \n Folder Path: %@", sourcePath, documentsDirectory, folderPath);

NSLog(@"docdire: %@", documentsDirectory);

NSLog(@"loadImage button clicked");

label.text = [@"sourcePath: " stringByAppendingString:sourcePath];

textField.text = [@"clicked: " stringByAppendingString:documentsDirectory];;

NSError *error;

if([[NSFileManager defaultManager] copyItemAtPath:sourcePath toPath:folderPath error:&error]){

NSLog(@"File successfully copied");

label.text = @"copy succeeded";

} else {

NSLog(@"Error description-%@ \n", [error localizedDescription]);

NSLog(@"Error reason-%@", [error localizedFailureReason]);

label.text = [@"Error description: " stringByAppendingString:[error localizedDescription]];

label2.text = [@"Error reason: " stringByAppendingString:[error localizedFailureReason]];

}

+0

我发现有2个地方有xxxxx.app包。一个用于模拟器,另一个用于构建分布。 –

2011-06-01 00:42:03

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值