Valor del tipo opcional 'Cadena?' no sin envolver; ¿Querías usar '!' o '?'
Defino una clase en Swift así:
class RecordedAudio: NSObject {
var title: String!
var filePathUrl: NSURL!
init(title: String, filePathUrl: NSURL) {
self.title = title
self.filePathUrl = filePathUrl
}
}
Después de eso, declaro la var global de este en el controlador
var recordedAudio: RecordedAudio!
Y luego, cree la instancia en esta función:
func audioRecorderDidFinishRecording(recorder: AVAudioRecorder!, successfully flag: Bool) {
if(flag){
// save recorded audio
recordedAudio = RecordedAudio(title: recorder.url.lastPathComponent, filePathUrl: recorder.url)
...
Pero recibí el mensaje de error en línea. Creo la instancia de RecordedAudio:
Valor del tipo opcional 'Cadena?' no sin envolver; ¿Querías usar '!' o '?'
¿Podrías ayudarme en este caso? Soy un principiante de Swift ...