微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

System.Exception+ExceptionMessageKind.OutOfMemory in Xamarin form IOS如何处理?

如何解决System.Exception+ExceptionMessageKind.OutOfMemory in Xamarin form IOS如何处理?

System.Exception+ExceptionMessageKind.OutOfMemory 当我点击按钮录制音频时 如何处理和如何在 IOS 中扩展内存这可能编码它在 android 中工作正常,但不适用于 IOS 为录音机(如麦克风和内存)设置的所有权限。

        ` private async void bntRecord_Clicked(object sender,EventArgs e)
        {
        try
        {
            if (!recorder.IsRecording)
            {
                seconds = 0;
                minutes = 0;
                isTimerRunning = true;
                Device.StartTimer(TimeSpan.FromSeconds(1),() =>
                {
                    seconds++;

                    if (seconds.ToString().Length == 1)
                    {
                        lblSeconds.Text = "0" + seconds.ToString();
                    }
                    else
                    {
                        lblSeconds.Text = seconds.ToString();
                    }
                    if (seconds == 60)
                    {
                        minutes++;
                        seconds = 0;

                        if (minutes.ToString().Length == 1)
                        {
                            lblMinutes.Text = "0" + minutes.ToString();
                        }
                        else
                        {
                            lblMinutes.Text = minutes.ToString();
                        }

                        lblSeconds.Text = "00";
                    }
                    return isTimerRunning;
                });
                recorder.StopRecordingOnSilence = IsSilence.IsToggled;
                var recordTask = await recorder.StartRecording();
                bntRecord.IsEnabled = false;
                bntRecord.BackgroundColor = Color.Silver;
                bntPlay.IsEnabled = false;
                bntPlay.BackgroundColor = Color.Silver;
                bntStop.IsEnabled = true;
                bntStop.BackgroundColor = Color.FromHex("#7cbb45");
                await recordTask;

            }
        }
        catch (Exception)
        {

            throw;
        }
    }`

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。