미디어 저장소 포맷
formatStorage로 연결된 기기에 저장된 모든 사진, 동영상 및 녹음을 삭제합니다. 이 API는 별도의 파일 시스템 포맷 명령이 아니라 기존의 모든 미디어 삭제 작업을 호출합니다.
:::danger 파괴적 작업
기기의 모든 미디어가 삭제되며 SDK는 복구 기능을 제공하지 않습니다. 시작 전에 사용자의 명시적 확인을 받으세요.
:::
전제 조건
- 기기가 연결되어 준비 상태가 될 때까지 기다립니다.
- 녹화를 중지하고 진행 중인 미디어 가져오기를 완료하거나 취소합니다.
- 작업 중에는 중복 요청을 비활성화합니다.
AI를 활용해 구현
AI로 구현
AI로 이 워크플로 구현
공식 “AIBuds 저장소 포맷” 스킬을 사용해 앱에 맞게 구현하세요.
https://docs-aibuds.github.io/ko/skills/implement-aibuds-format-storage을 읽고 지침을 따르세요. 이 스킬로 “AIBuds 저장소 포맷”을 이 iOS 프로젝트에 구현하고 검증하세요.API 동작
완료 콜백은 모든 미디어 삭제 요청이 수락되었는지 알립니다. 갱신된 미디어 개수나 저장소 정보는 반환하지 않습니다.
사용 예제
- Swift
- Objective-C
import AIBuds
func formatMediaStorage(on device: DeviceConvertible) {
guard let device = device as? DeviceCommonAPI else {
print("This device does not support common operations")
return
}
device.formatStorage { success, error in
DispatchQueue.main.async {
if success {
print("All device media was deleted")
} else {
print("Delete failed: \(error?.localizedDescription ?? "Unknown error")")
}
}
}
}#import <AIBuds/AIBuds-Swift.h>
- (void)formatMediaStorageOnDevice:(id<AIBudsDeviceConvertible>)device {
if (![device conformsToProtocol:@protocol(AIBudsDeviceCommonAPI)]) {
NSLog(@"This device does not support common operations");
return;
}
[(id<AIBudsDeviceCommonAPI>)device
formatStorageWithCompletion:^(BOOL success, NSError *_Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (success) {
NSLog(@"All device media was deleted");
} else {
NSLog(@"Delete failed: %@",
error.localizedDescription ?: @"Unknown error");
}
});
}];
}