Как установить звуковое локальное уведомление из песни в iTunes?

Я пытаюсь создать приложение будильника, но не знаю, как настроить песню из iTunes на звук локального уведомления.

Теперь я использую этот код для вызова iTunes

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];

        picker.delegate = self;
        picker.allowsPickingMultipleItems = NO;
        picker.prompt = NSLocalizedString (@"Select any song from the list", @"Prompt to user to choose some songs to play");

        //[self presentModalViewController: picker animated: YES];
        [self.navigationController pushViewController:picker animated:YES];

        NSLog(@"gsudifghukdsf");
        [picker release];

    }
}

- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection 
{
    [self.navigationController popToRootViewControllerAnimated:YES];
    //[self dismissModalViewControllerAnimated: YES];
    NSLog(@"%@",mediaItemCollection);

    UILocalNotification *local = [[UILocalNotification alloc] init];
    //selectedSongCollection=mediaItemCollection; 

}

- (void) mediaPickerDidCancel: (MPMediaPickerController *) mediaPicker
{    
    [self.navigationController popToRootViewControllerAnimated:YES];
    //[self dismissModalViewControllerAnimated: YES]; 
}

, и кое-что о локальном уведомлении выглядит примерно так

 UILocalNotification *localNotif = [[UILocalNotification alloc] init];
    if (localNotif == nil)
    {   //NSLog(@"Get in if localNotif");
        return;
    }

    localNotif.fireDate = DateAlarm;

    localNotif.timeZone = [NSTimeZone defaultTimeZone];

    // Notification details
    localNotif.alertBody = [NSString stringWithFormat:@"%@",DateAlarm];
    // Set the action button
    localNotif.alertAction = @"Oh Shit";



    localNotif.soundName = UILocalNotificationDefaultSoundName;

Пожалуйста, посоветуйте мне, как установить локальный звук для песни ??

7
задан crazyoxygen 1 August 2011 в 03:35
поделиться