保存声音的方法:
-(BOol)saveAudio:(Nsstring*)key NSLog(key); BOolsaveSuccess=FALSE; Nsstring*dbPath=[[[NSBundlemainBundle]resourcePath]stringByAppendingPathComponent:@"testVoice.db"]; if(sqlite3_open([dbPathUTF8String],&database_voice)==sqlITE_OK) Nsstring*sqlString=[NsstringstringWithFormat:@"select*fromtb_voicewhereID='%@'",key]; NSLog(sqlString); constchar*sql_char=[sqlStringUTF8String]; //preparetheselectstatement intreturnValue=sqlite3_prepare_v2(database_voice,sql_char,-1,&selectStatement,NulL); if(returnValue==sqlITE_OK) //loopalltherowsreturnedbythequery. if(sqlite3_step(selectStatement)==sqlITE_ROW) Nsstring*filename=[NsstringstringWithUTF8String:(char*)sqlite3_column_text(selectStatement,0)]; ////NSLog(filename); NSData*fileData=[NSDatadataWithBytes:sqlite3_column_blob(selectStatement,0)">2)length:sqlite3_column_bytes(selectStatement,0)">2)]; //savethefiledata //check Nsstring*filepath=[cachePathstringByAppendingPathComponent:filename]; filepath=[filepathstringByAppendingString:@".wav"]; if([fileManagercreateDirectoryAtPath:cachePathattributes:nil]==NO){ ////NSLog(@"fileManagercreateDirectoryAtPath:cachePathattributes:nil"); if([fileDatawritetofile:filepathatomically:YES]){ saveSuccess=TRUE; //NSLog(@"saveSuccess"); ////NSLog(@"returnValue"); //NSLog(@"saveFail"); sqlite3_finalize(selectStatement); returnsaveSuccess; } 总结
以上是内存溢出为你收集整理的UIWebView 相应本地事件全部内容,希望文章能够帮你解决UIWebView 相应本地事件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)