小编Dam*_*ito的帖子

如何编辑Xcode上的多行(快捷方式)

对不起,我没有找到这个问题的问题...

在Xcode中,编辑多个行的快捷方式是什么,比如sublime文本的"CMD + click"?

在此输入图像描述

xcode edit shortcut multiline

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

24
推荐指数
8
解决办法
2万
查看次数

隐藏autolayout UIView:如何让现有的NSLayoutConstraint更新这个

我知道如何修改现有约束.但我想知道是否有人找到了一个解决方案来获得一个约束而不保存这个属性.

当前设置约束高度的解决方案:

1)将NSLayoutConstraint保存在变量中:

NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:myView
                                                                    attribute:NSLayoutAttributeHeight
                                                                    relatedBy:NSLayoutRelationEqual
                                                                       toItem:nil
                                                                    attribute:NSLayoutAttributeNotAnAttribute
                                                                   multiplier:1.0f
                                                                     constant:20];
[self.view addConstraint:heightConstraint];
Run Code Online (Sandbox Code Playgroud)

2)将约束的常量设置为"0.0"(隐藏此视图)

[heightConstraint setConstant:200];
Run Code Online (Sandbox Code Playgroud)

我正在寻找这样的解决方案:

 [myView setConstraint:@"0." forAttribute:NSLayoutAttributeHeight]
Run Code Online (Sandbox Code Playgroud)

objective-c show-hide uiview autolayout nslayoutconstraint

11
推荐指数
2
解决办法
2万
查看次数

无法添加名为 `trunk` 的 URL 为 `https://cdn.cocoapods.org/` 的源

我正在为 ios 构建一个带有电容器的应用程序。当我启动命令“npx cap sync ios”(启动pod install)时,我收到此错误:

? Updating iOS native dependencies with "pod install" (may take several minutes): 
? update ios: 
[error] Error running update: Analyzing dependencies
Cloning spec repo `trunk` from `https://cdn.cocoapods.org/`
[!] Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`.
You can try adding it manually in `/Users/damien/.cocoapods/repos` or via `pod repo add`.
Run Code Online (Sandbox Code Playgroud)

如果我执行推荐:

pod repo add trunk https://cdn.cocoapods.org/
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

[!] Repo name `trunk` is reserved for CocoaPods' main spec repo accessed via …
Run Code Online (Sandbox Code Playgroud)

ios cocoapods capacitor

11
推荐指数
4
解决办法
1万
查看次数

如何获取设备的公共IP地址

我找到了这个示例代码来获取所有本地IP地址,但我找不到一个简单的解决方案来获取公共IP.

来自Apple 的传统课程允许这样做...但它的遗产......

public objective-c ip-address ios

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

使用 firebase SDK 在我的 React 应用程序上进行 Google 分析

我在许多网站上经常使用 Google Analytics...

我刚刚发布了第一个带有 Firebase 的应用程序(带有 reactjs 的 Firestore + Firebase SDK)。

然后,我从 Firebase 仪表板激活了 GA...但我看不到任何活动!

在此处输入图片说明

我可能不需要添加像“autotrack”这样的插件?

import 'autotrack';
ga('create', 'UA-XXXXX-Y', 'auto');
Run Code Online (Sandbox Code Playgroud)

不清楚,因为无法从我的仪表板中找到曲目 ID (UA-XXXXX-Y)!

我真的需要吗?我在哪里可以找到它? 在此处输入图片说明

google-analytics firebase

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

Chrome更新版块闪存自动播放 - 如何避免它?

我在一个html页面中嵌入了一个YouTube视频.我使用带有Flash的youtube iframe API(在我的情况下,我不能使用HTML5视频).自上次谷歌Chrome更新以来,Chrome会阻止自动播放并避免以编程方式播放/暂停视频(element.playVideo()无响应).(在其他浏览器上一切正常)

我找到的唯一方法是:

  • 进入Chrome偏好设置
  • 然后点击显示高级设置...
  • 然后点击内容设置
  • 然后在插件下,选择第一个选择运行所有插件内容(或选择一个特定的例外)

在此输入图像描述

这个解决方案对用户来说是复杂的,有人有没有任何用户交互的解决方案吗?

javascript youtube flash google-chrome youtube-iframe-api

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

IOS7 - UIWebView:当应用程序进入后台时,HTML5音频暂停

这个问题不是这个UIWebView的重复帖子:当应用程序进入后台时,HTML5音频在iOS 6中暂停

我可以从控制中心访问音轨但音频已停止.如何避免暂停状态,或者如何在后台线程中重放曲目?

我的所有代码都在这里.您可以将代码粘贴到新的空ios应用程序的AppDelegate中

  • 添加AVFoundation框架
  • 启用背景音频
  • 我没有工作,它出现在控制中心,但当应用程序进入后台时音乐暂停!

    #import "AppDelegate.h"
    #import <AVFoundation/AVFoundation.h>
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
    
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        BOOL ok;
        NSError *setCategoryError = nil;
        ok = [audioSession setCategory:AVAudioSessionCategoryPlayback
                                 error:&setCategoryError];
        if (!ok) {
            NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError);
        }
    
    
        UIViewController *vc = [[UIViewController alloc] init];
        UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController: vc];
        self.window.rootViewController = nav;
    
    
        //WEBVIEW
        UIWebView *myWeb …
    Run Code Online (Sandbox Code Playgroud)

youtube audio ios html5-audio ios7

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

带有Soundcloud流项的AVQueuePlayer(或AVPlayer)阻止UI(主线程)

感谢这两篇文章,我在创建AVPLayerItem AVQueuePlayer播放 期间解决了这个问题, 没有间隙,并且冻结AVPlayer在缓冲音频流的过程中"冻结"应用程序

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL URLWithString:urlString] options:@{AVURLAssetPreferPreciseDurationAndTimingKey : @(YES)}];
    NSArray *keys = @[@"playable", @"tracks",@"duration" ];

    [asset loadValuesAsynchronouslyForKeys:keys completionHandler:^()
     {

         for (NSString *thisKey in keys) {
             NSError *error = nil;
             AVKeyValueStatus keyStatus = [asset statusOfValueForKey:thisKey error:&error];
             if (keyStatus == AVKeyValueStatusFailed) {
                 return ;
             }
         }

         AVPlayerItem *item = [[AVPlayerItem alloc] initWithAsset:asset];

         dispatch_async(dispatch_get_main_queue(), ^ {

             [item addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];

             [player insertItem:item afterItem:nil];

         });

     }];
});
Run Code Online (Sandbox Code Playgroud)

但是,使用来自Soundcloud的流(https://api.soundcloud.com/tracks/146924238/stream?client_id=76395c48f97de903ff44861e230116bd),在项目状态准备好播放(AVPlayerStatusReadyToPlay)之后,AVQueueplayer继续在主线程中执行某些操作"冻结"UI(跟踪继续在后台线程中播放).

我注意到这个问题在网络较低时更为重要,然后我得出结论,当项目缓冲流时,此冻结存在.

有人有解决方案或诀窍吗?

objective-c freeze soundcloud avplayer avqueueplayer

6
推荐指数
0
解决办法
848
查看次数

Express和BrowserSync没有吞咽?

我正在开发一个快速应用程序.我只使用browserSync来观看静态文件,但是现在,我想用快速应用程序做同样的事情.

我看到很多使用Gulp的例子.但我想知道是否有任何解决方案只能使用npm脚本进行管理?(和nodemon?)

我目前的脚本:

"scripts": {
    "start": "npm run start-server & npm run watch-js",
    "build-js": "browserify -t babelify -t aliasify -t partialify src/ | uglifyjs > public/app.js",
    "start-server": "browser-sync start --server 'public/' --files 'public/' --port 9000 --no-ui",
    "watch-js": "watchify -vd -t babelify -t aliasify -t partialify src/ -o public/app.js",
  },
Run Code Online (Sandbox Code Playgroud)

node.js express nodemon gulp browser-sync

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