خرید بک لینک

Vote count: 0

How can I check if a file is download and save on device? How can I check if a file is download and save on device?

- (void) song{
if (_index1 == 0) {
NSString *stringURL = @"https://drive.google.com/uc?export=download&id=0B0EJbcHq3ZALWUo0a05LMWNzeDg";
NSURL  *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"music.mp3"];
    [urlData writeToFile:filePath atomically:YES];
    self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:filePath] error:nil];

    }
}

}

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 9 اسفند 1394 ساعت: 20:10

صفحه بندی