小编pin*_*nki的帖子

无限CABasicAnimation停止

CABasicAnimation在UIView中有一个无限的动画(旋转图像,输入:)

animation.repeatCount = HUGE_VALF;
Run Code Online (Sandbox Code Playgroud)

当我按下一个新的ViewController并返回到包含View里面的动画的初始ViewController时,旋转停止了.

即使我viewWillAppear在调用ViewController的方法时再次设置动画,它也不会再次旋转.

我究竟做错了什么?

calayer uiview cabasicanimation ios

18
推荐指数
2
解决办法
5024
查看次数

AVAssetExportSession每次都失败(错误-12780)

我正在尝试合并一些音频文件(通过MPMediaPickerController选择),但导出始终失败,错误代码为-12780.

当我尝试使用AVPlayer对象播放我的合成时,它会正确播放.只是出口失败了.

我究竟做错了什么?

这是我的代码:

AVAssetExportSession *exportSession;
AVPlayer *player;

- (void)mergeAudiofiles {
    // self.mediaItems is an NSArray of MPMediaItems
    if (self.mediaItems.count == 0) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                        message:@"No Tracks selected."
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
        return;
    }

    // Configure audio session
    NSError *sessionError;
    AVAudioSession *session = [AVAudioSession sharedInstance];
    [session setCategory:AVAudioSessionCategoryAudioProcessing error:nil];
    [session setActive:YES error:&sessionError];
    if (sessionError) NSLog(@"Session-Error: %@", sessionError.localizedDescription);

    // Create composition
    AVMutableComposition *composition = [AVMutableComposition composition];
    AVMutableCompositionTrack *track = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
    CMTime position = kCMTimeZero;

    for …
Run Code Online (Sandbox Code Playgroud)

avfoundation ios avassetexportsession

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

如何将WPF DataGridTextColum Text最大长度限制为10个字符

如何将WPF DataGridTextColumn文本限制为最大长度为10个字符.

我不想使用DatagridTemplateColumn,因为它有内存泄漏问题.

该字段也绑定到数据实体模型.

c# wpf wpfdatagrid c#-4.0

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

在子域中跨ASP.NET共享ASP.NET 5中的身份验证Cookie

我有两个ASP.NET 5 MVC 6应用程序.

一种是在运行www.mydomain.tld,一个在world1.mydomain.tld.

如果用户登录www子域的应用程序,我希望她也登录到world1子域的应用程序.登录是使用ASP.NET Identity 3实现的.

我已将这两个应用程序设置Startup.cs如下:

public void ConfigureServices (IServiceCollection services) {
    // [...]

    services.AddCaching();
    services.AddSession(
        options => {
            options.CookieDomain = ".mydomain.tld";
            options.IdleTimeout = TimeSpan.FromMinutes(30);
        }
    );

    // [...]
}

public void Configure (IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory) {
    // [...]

    app.UseCookieAuthentication(null, IdentityOptions.ExternalCookieAuthenticationScheme);
    app.UseCookieAuthentication(null, IdentityOptions.TwoFactorRememberMeCookieAuthenticationScheme);
    app.UseCookieAuthentication(null, IdentityOptions.TwoFactorUserIdCookieAuthenticationScheme);
    app.UseCookieAuthentication(
        config => {
            config.CookieDomain = ".mydomain.tld";
        },
        IdentityOptions.ApplicationCookieAuthenticationScheme
    );

    // [...]
}
Run Code Online (Sandbox Code Playgroud)

我还通过web.config以下方式设置了两个应用程序的机器密钥:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <machineKey decryption="AES" …
Run Code Online (Sandbox Code Playgroud)

asp.net authentication cookies single-sign-on asp.net-core

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