본문으로 건너뛰기
CloudClick iOS

Photos & files

Count and clear the photos and videos in the library, save images or videos into it, and download files into the app. The first call asks for photo library access.

기능 개요

  • ·Saving and deleting return true / false only after the system has finished
  • ·Deleting taps through the system confirmation for you

getPicCount#

The number of images in the photo library (videos excluded).

typescript
getPicCount(): number;

반환값

타입설명
numberThe image count, or 0 without photo access (a log line says so).

예제

javascript
logi('photos: ' + getPicCount());

관련 항목 getVideoCount

getVideoCount#

The number of videos in the photo library.

typescript
getVideoCount(): number;

반환값

타입설명
numberThe video count, or 0 without photo access.

예제

javascript
logi('videos: ' + getVideoCount());

관련 항목 getPicCount

deleteAllPic#

Delete every image in the photo library.

typescript
deleteAllPic(): boolean;

반환값

타입설명
booleanReturns once deletion has finished: true on success (or when there was nothing to delete), false on failure (no photo access, the prompt was declined, …) with the reason in the error log.

예외

예외발생 조건
WDAErrorFEATURE_UNAVAILABLEThe app on the device is too old to have this feature; update the app.

주의사항

  • iOS always asks for confirmation before deleting from the photo library; the script taps Delete for you, switching to the Photos app and back in the process.
  • Deleted items go to Recently Deleted first and can be recovered for 30 days; iOS offers no public way to empty Recently Deleted.

예제

javascript
if (!deleteAllPic()) {
  return false;
}

관련 항목 deleteAllVideo、deleteAllPicAndVideo

deleteAllVideo#

Delete every video in the photo library. Works like deleteAllPic.

typescript
deleteAllVideo(): boolean;

반환값

타입설명
booleanReturns once deletion has finished: true on success (or when there was nothing to delete), false on failure (no photo access, the prompt was declined, …) with the reason in the error log.

예외

예외발생 조건
WDAErrorFEATURE_UNAVAILABLEThe app on the device is too old to have this feature; update the app.

주의사항

  • iOS always asks for confirmation before deleting from the photo library; the script taps Delete for you, switching to the Photos app and back in the process.
  • Deleted items go to Recently Deleted first and can be recovered for 30 days; iOS offers no public way to empty Recently Deleted.

예제

javascript
deleteAllVideo();

관련 항목 deleteAllPic

deleteAllPicAndVideo#

Delete every image and video in the photo library. Works like deleteAllPic.

typescript
deleteAllPicAndVideo(): boolean;

반환값

타입설명
booleanReturns once deletion has finished: true on success (or when there was nothing to delete), false on failure (no photo access, the prompt was declined, …) with the reason in the error log.

예외

예외발생 조건
WDAErrorFEATURE_UNAVAILABLEThe app on the device is too old to have this feature; update the app.

주의사항

  • iOS always asks for confirmation before deleting from the photo library; the script taps Delete for you, switching to the Photos app and back in the process.
  • Deleted items go to Recently Deleted first and can be recovered for 30 days; iOS offers no public way to empty Recently Deleted.

예제

javascript
deleteAllPicAndVideo();

관련 항목 deleteAllPic

savePicVideo#

Save an image or a video into the photo library; the file extension decides which.

typescript
savePicVideo(pathOrBase64: string, filename?: string): boolean;

매개변수

이름타입필수기본값설명
pathOrBase64string예—A file path inside the app (relative to its Documents folder; files from downloadAndSaveFile live under sync/), or base64 data (a data: prefix is accepted).
filenamestring아니오—With base64 data, its extension decides image or video — for example cover.jpg or intro.mp4.

반환값

타입설명
booleanReturns once the system has actually written the item: true on success, false on failure with the reason in the error log.

예외

예외발생 조건
WDAErrorFEATURE_UNAVAILABLEThe app on the device is too old to have this feature; update the app.

예제

javascript
savePicVideo('sync/intro.mp4');
savePicVideo(client.screenshot(), 'screen.png');

관련 항목 downloadAndSaveFile、downloadAndSavePicVideo

downloadAndSavePicVideo#

Download an image or a video and save it into the photo library; the downloaded content decides which.

typescript
downloadAndSavePicVideo(url: string): boolean;

매개변수

이름타입필수기본값설명
urlstring예—The download address. An address starting with / is resolved against the server (for example a File Sync file).

반환값

타입설명
booleanReturns once the system has actually written the item: true on success, false on failure with the reason in the error log.

예외

예외발생 조건
WDAErrorFEATURE_UNAVAILABLEThe app on the device is too old to have this feature; update the app.

예제

javascript
downloadAndSavePicVideo('https://example.com/a.mp4');

관련 항목 savePicVideo

downloadAndSaveFile#

Download any file into the app's sync/ folder (visible in the Files app under On My iPhone → WTScript → sync), named after the last segment of the address.

typescript
downloadAndSaveFile(url: string): boolean;

매개변수

이름타입필수기본값설명
urlstring예—The full download address (starting with http:// or https://).

반환값

타입설명
booleanTrue when the file was downloaded and saved. Waits 120 seconds at most.

예제

javascript
if (downloadAndSaveFile('https://example.com/intro.mp4')) {
  savePicVideo('sync/intro.mp4');
}

관련 항목 savePicVideo