diff --git a/ios/App/App/plugins/AbsDownloader.swift b/ios/App/App/plugins/AbsDownloader.swift index d2b9a003..ea68e482 100644 --- a/ios/App/App/plugins/AbsDownloader.swift +++ b/ios/App/App/plugins/AbsDownloader.swift @@ -28,10 +28,11 @@ public class AbsDownloader: CAPPlugin { } } } + func startLibraryItemDownload(libraryItem: LibraryItem) { - let length = libraryItem.media.tracks.count + let length = libraryItem.media.tracks?.count ?? 0 if length > 0 { - libraryItem.media.tracks.enumerated().forEach { position, track in + libraryItem.media.tracks?.enumerated().forEach { position, track in NSLog("TRACK \(track.contentUrl!)") // filename needs to be encoded otherwise would just use contentUrl let filename = track.metadata?.filename ?? ""