小编Jer*_*606的帖子

AVAudioEngine Xamarin.iOS没有捕获异常引擎所需的运行

我正在使用Xamarin.iOS作为使用AVAudioEngine的应用程序.

有时我得到这个例外:

AVFoundation_AVAudioPlayerNode_Play由于未捕获的异常'com.apple.coreaudio.avfaudio'而终止应用程序,原因:'必需条件为false:_engine-> IsRunning()'

这指向我的代码:

private Dictionary<AudioTrack, AVAudioPlayerNode> _dicPlayerNodes;
private void PlayAudio()
{
    try
    {
        NSError err;
        if (Engine.StartAndReturnError(out err))
        {
            foreach (var audioTrack in _dicPlayerNodes)
            {
                 AVAudioPlayerNode node = audioTrack.Value;
                 node.Play();
            }
        }
        else
        {
            Messenger.Publish(new AudioErrorMessage(this) { Platform = "IOS", Code = Convert.ToInt32(err.Code), Message = err.LocalizedDescription ?? err.Description });

            _exceptionHandlerService.PostHockeyApp(new Exception($"{err.Code} {err.Description}"));
        }
    }
    catch (Exception ex)
    {
        _exceptionHandlerService.PostExceptionAsync(ex).Forget();
    }
}
Run Code Online (Sandbox Code Playgroud)

我不明白怎么可能有这个异常引擎没有运行,因为在我的代码中我启动它并获得错误,如果它无法启动...然后播放它.

此外,我有一个尝试捕获在这种情况下不工作:(所以我的应用程序刚刚崩溃.

有什么建议或想法吗?

我来到这个主题,但它无法帮助我理解:https: //forums.developer.apple.com/thread/27980

版本:

  • IOS版本:10.3.3

  • 设备:ipad 2

  • Xamarin.ios:11.2.0.11

谢谢

c# xamarin.ios ios xamarin avaudioengine

7
推荐指数
0
解决办法
161
查看次数

Typescript requirejs web essentials 2.9

我只是将Web essentials和Typescript更新到新版本.

结果我的项目不再工作了.

这是我的打字稿代码:

/// <reference path="DefinitelyTyped/jqueryui.d.ts" />
/// <reference path="DefinitelyTyped/jquery-datatable.d.ts" />

import Common = module("Common");
import GMap = module("GMap");

declare var $: JQueryStatic;

export class Polygon extends GMap.Polygon {
Run Code Online (Sandbox Code Playgroud)

在更新之前,我生成的代码(有效)是:

var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
define(["require", "exports", "GMap", "Common"], function(require, exports, __GMap__,          __Common__) {
var GMap = __GMap__;

var Common = __Common__;

var Polygon = (function (_super) {
    __extends(Polygon, _super); …
Run Code Online (Sandbox Code Playgroud)

import requirejs typescript web-essentials

6
推荐指数
1
解决办法
1043
查看次数

指令$ formatters在写入时影响ngModel

我有一个问题是使用$ formatters.

我的目标是隐藏电话号码,只留下最后4个字符.如果你不在输入中写任何东西就没问题.如果你写的东西,模型会受到掩码的影响,我在DB中注册隐藏的手机......

这是我使用的指令:

.directive('tsHideField', function () {
return {
    require: 'ngModel',
    restrict: 'A',
    link: function (scope, element, attributes, controller) {

        var maskValue = function (value) {
            if (!value) {
                return "";
            }
            if (value.length <= 4) {
                return value;
            }
            var valueHide = "";
            if (value.indexOf('@') === -1) {
                //leave last 4 chars
                valueHide = value.toString().substring(0, value.length - 4).replace(/[\S]/g, "\u2022");
                return valueHide + value.toString().substring(value.length - 4);
            } else {
                //Adresse email, on laisse après le @ et on cache …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-directive

5
推荐指数
1
解决办法
120
查看次数

使用AD FS和OWIN的SSO如何创建帐户和处理权限

我配置了一个使用AD FS的Web App,为此我使用了OWIN.

对于登录,一切都好.如果我是域名的用户并访问该网站,则会自动连接.

但我想要的是在登录后自己处理用户和角色.

所以我想用这个AD帐户检查我的数据库中是否存在用户(此过程将在另一个应用程序登录之前生成)

我想使用Microsoft的Identity来处理声明(角色和权限).但我不明白如何将我的代码用于处理来自AD FS(使用Ws-Federation)的成功连接,并添加验证并填写正确的角色.

我在ConfigureAuth中的代码:

public partial class Startup
{
    private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
    private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
    private NLogLoggingService _loggingService;

    public void ConfigureAuth(IAppBuilder app)
    {
        _loggingService = new NLogLoggingService("Startup");
        _loggingService.Debug("ConfigureAuth");

        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseWsFederationAuthentication(
            new WsFederationAuthenticationOptions
            {
                Wtrealm = realm,
                MetadataAddress = adfsMetadata,

                //CallbackPath = PathString.FromUriComponent("/Account/TestCallback"),

                // https://msdn.microsoft.com/en-us/library/microsoft.owin.security.authenticationmode(v=vs.113).aspx
                AuthenticationMode = AuthenticationMode.Passive,

                //Notifications = new WsFederationAuthenticationNotifications
                //{

                //}
            });

    }
Run Code Online (Sandbox Code Playgroud)

在Web.config中,realm是我的Web App的链接(https://ssoadfs.test),adfsMetadata是AD FS的metadata.xml链接.

AD FS连接后设置角色和登录逻辑的方法是什么?

架构,我在想什么:

在此输入图像描述

编辑:经过一些尝试,我无法处理任何成功的回调.我不想在HomeController中处理角色......

我上次的Auth配置:

            _loggingService = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc adfs ws-federation owin

5
推荐指数
1
解决办法
1850
查看次数

带后缀触发的 angular matSelect 点击清除

我正在尝试在我的输入右侧添加一个简单的图标以清除他的内容。

我不想在我的列表中添加“无”选项。

我想添加一个“清除”按钮。

实际上,一切正常,但是当我单击清除按钮时,选择正在显示...

这是一个测试代码:https : //stackblitz.com/edit/angular-mpbl8q

<mat-form-field>
  <mat-label>State</mat-label>
  <mat-select [(ngModel)]="currentState" name="State">
    <mat-option *ngFor="let state of states" [value]="state">{{state}}</mat-option>
  </mat-select>
  <div matSuffix>
    <mat-icon (click)="currentState = null">clear</mat-icon>
  </div>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

点击 clear 正在打开 mat-select

angular-material angular

3
推荐指数
1
解决办法
2287
查看次数

InvalidOperationException错误反映类

读取多次与此错误相关的帖子并没有找到我的问题的解决方案后,我在这里解释.

我使用XmlSerializer来序列化简单类.

这是我的代码:

    private void btnGenerateXml_Click(object sender, RoutedEventArgs e)
    {
        Orchard orchard = new Orchard
        {
            Recipe = new Recipe
            {
                Name = "Generated by JooWeb.Tools",
                Author = "admin",
                ExportUtc = DateTime.UtcNow
            },
            MyDatas = new MyDatas
            {
                //Test = "test"
                TrendDatas = new TrendDatas
                {
                    Id = null,
                    Status = "Published",
                    TrendDatasPart = new TrendDatasPart
                    {
                        IdSource = 0,
                        PostalCode = "1000",
                        Locality = "Test5",
                        Surface = (decimal)0.00,
                        Price = (decimal)0.00,
                        Type = "",
                        InsertDateIndicator = "",
                        UpdateDateIndicator = …
Run Code Online (Sandbox Code Playgroud)

c# xml xml-serialization invalidoperationexception xmlserializer

2
推荐指数
1
解决办法
4355
查看次数

如何在javascript中将对象键点符号转换为对象树

我有一个表单,我想将它发送到一个 ajax 端点,为此我有这个辅助方法:

    $.fn.serializeFormToObject = function() {
      //serialize to array
      var data = $(this).serializeArray();
      //add also disabled items
      $(':disabled[name]', this)
        .each(function() {
            data.push({ name: this.name, value: $(this).val() });
        });

      //map to object
      var obj = {};
      data.map(function(x) { obj[x.name] = x.value; });
      return obj;
    };
Run Code Online (Sandbox Code Playgroud)

问题是我的表单的某些名称中有点符号(使用 MVC 强类型模型)所以我有这个对象作为结果:

Task.Addresses.Box:""
Task.Addresses.City:"Limal"
Task.Addresses.Country:"Belgique"
Task.Deadline:"1/10/2017 12:18:18 PM"
Task.TaskSourceId:"1"
Run Code Online (Sandbox Code Playgroud)

预期的结果是:

{ Task : { Addresses: { Box: "", City: "Limal", Country: "Belgique"}, Deadline: "1/10/2017 12:18:18 PM", TaskSourceId:"1" } }
Run Code Online (Sandbox Code Playgroud)

我使用 lodash 库,但几个小时后我找不到实现此预期结果的方法。

有人可以为我提供一个有效的 javascript …

javascript jquery lodash

1
推荐指数
1
解决办法
1661
查看次数