0

私の考え: Wi-Fi や Bluetooth なしで音楽を同期します。カメラ接続キットを使用して、JAILBREAKING なしで iPad との間でファイルをコピーするのが回避策です。まず、必要なファイルを取得してから、それらを zip ファイルに圧縮します。次に、拡張子 JPG の名前を変更して、iPad がファイルを認識できるようにします。次に、それを SD カードにコピーし、カメラ接続キットを使用して iPad に接続します。

ファイル拡張子を zip に戻してから抽出してファイルを取得できるように、アプリで jpg 形式の dcim 全体をコピーする必要がありました。

しかし、これまでのところ、ファイル/jpg をアプリにコピーする方法しか見つかりませんでしたが、ファイル拡張子を zip に戻し、それを別のアプリにエクスポートして解凍してファイルを取得する必要があります。

Ps: アプリでファイル拡張子を変更してエクスポートする方法を理解する必要があります。

4

1 に答える 1

4

iOSはファイルの名前変更をサポートしていないため、ファイル拡張子を簡単に変更できます。ファイルを複製して、zip拡張子を含むパスに書き込むだけです。

//get the documents directory
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

//append the name of the file in jpg form
NSString *jpgPath = [documentsDirectory stringByAppendingPathComponent:@"myFile.jpg"];

//check if the file exists (completely unnecessary).
if ([fileManager fileExistsAtPath:jpgPath]) {
    //get new resource path with different extension
    NSString *resourcePath = [documentsDirectory stringByAppendingPathComponent:@"myFile.zip"];
    //copy it over
    [fileManager copyItemAtPath:jpgPath toPath:resourcePath error:&error];
}
于 2012-07-07T23:56:48.813 に答える