I am seeing occasional exceptions with this code: AudioSession.Initialize ();
AudioSession.Category = AudioSessionCategory.PlayAndRecord; The exception is: MonoTouch.AudioToolbox.AudioSessionException: AudioSession.Initialize has not been called at MonoTouch.AudioToolbox.AudioSession.SetInt (AudioSessionProperty property, Int32 val) [0x00000] in <filename unknown>:0 at MonoTouch.AudioToolbox.AudioSession.set_Category (AudioSessionCategory value) [0x00000] in <filename unknown>:0 This happens very infrequently, but it is usually after the app has been backgrounded and then reopened. Looking at the IL for AudioSession::Initialize it looks like MT sets an initialized flag and doesn't call the underlying AudioSessionInitialize function if thats been set, so basically every time you call AudioSession::Initialize after the first time you call it, its a noop. I can't find anything in the AudioSession docs that say you should call AudioSessionInitialize when the app is woken up, but based on that exception, I think you need to. In my most recent crash report the app was backgrounded for three hours, so its not surprising that it would somehow "lose" its Audio Session, but that initialized flag will still be set. I think the best solution might be to always call AudioSessionInitialize (it will return an error code if the session is already initialized) and bail before doing the MT specific setup if its already initialized. I can file this as a bug if you'd like, I just posted to the list because I'm still not 100% an AudioSessionInitialize call should be needed. Jackson
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
