一般的な UIPasteboard を使用してオーディオ合成アプリにオーディオ コピー機能を実装しているため、コピーしたオーディオをMAPI (AudioCopy/AudioPasteまたはIntua オーディオ共有対応アプリ) に貼り付けることができます。プロセスに問題があるようで、コピーされたオーディオが AudioPaste 対応アプリに表示されません。
これは、オーディオを一般的な UIPasteboard にコピーするために行っていることです。
NSData *newItemData = [NSData dataWithContentsOfFile:[dataPath stringByAppendingPathComponent:@"converted.wav"]];
// This is the copy operation using the General Pasteboard otherwise known as the Intua Pasteboard
UIPasteboard *board = [UIPasteboard generalPasteboard];
[board setPersistent:TRUE];
NSData *dataFile = newItemData;
if (!dataFile) {
NSLog(@"Can't open file");
}
// Create chunked data and append to clipboard
NSUInteger sz = [dataFile length];
NSUInteger chunkNumbers = (sz / GP_CLIPBOARD_CHUNK_SIZE) + 1;
NSMutableArray *items = [NSMutableArray arrayWithCapacity:chunkNumbers];
NSRange curRange;
for (NSUInteger i = 0; i < chunkNumbers; i++) {
curRange.location = i * GP_CLIPBOARD_CHUNK_SIZE;
curRange.length = MIN(GP_CLIPBOARD_CHUNK_SIZE, sz - curRange.location);
NSData *subData = [dataFile subdataWithRange:curRange];
NSDictionary *dict = [NSDictionary dictionaryWithObject:subData forKey:(NSString *)kUTTypeAudio];
[items addObject:dict];
}
board.items = items;
この手順を実行した後、AudioPaste 互換アプリを起動すると、コピーしたオーディオが表示されません。オーディオ コピー コードの誤りを見つけてもらえますか?