tengo varias canciones en la carpeta de documentos (sandbox) cómo guardar en sqlite para la columna Perticaluer

I am recording the voice and storing it in sandbox and in next view whose voice name and this song store in sqlite. I already use a blob but app becomes too slow.So I want to sandbox path for particular song to store in sqlite database.

recorded saving purpose

- (void)saveRecordFile
    NSLog(@"play Record");
    if (audioPlayerRecord)
        if (audioPlayerRecord.isPlaying) [audioPlayerRecord stop];
        else [audioPlayerRecord play];


Initialize playback audio session

    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,    NSUserDomainMask, YES);
    NSString *recDir = [paths objectAtIndex:0];
    NSString *pathToSave = [recDir stringByAppendingPathComponent:[self dateString]];
    songUrl = [NSURL fileURLWithPath:pathToSave];

here songUrl have all the songs how to store in database.

preguntado el 28 de mayo de 14 a las 13:05

1 Respuestas

Don't convert your file path to an URL. Leave it as a path. Then simply save the path string into your database.

You should be able to save BLOBs to your database without slowing it down if you make the blobs a separate entity that is linked to the other entities in your database. Don't make a BLOB a field of a record. It makes the record too "heavy".

contestado el 28 de mayo de 14 a las 14:05

thank u.....i am trying like this...NSString *myString = [songUrl absoluteString]; - RameshIos

As @Zero says, you already have a path in pathToSave. Why convert that path to an NSURL, and then convert the URL back to a path? If you are determined to do it that way then you want [songUrl path]no, [songUrl absoluteString] - duncan c

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.