小编Tec*_*ain的帖子

Copy Bundle Resources构建阶段在xcode 6中包含此目标的Info.plist文件'Info.plist'?

我收到了这个警告 The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist'.我已经在这里阅读了解决方案它说Info.plist文件已被复制到复制包资源中我必须从那里删除它.但是我没有找到任何Info.plist.请建议什么做?

iphone xcode objective-c ipad ios

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

无法通过iOS中的AVPlayer播放文档目录中的音乐?

我正在使用MediaPickerController选择音乐文件.在我从选择器中选择音乐文件后,我将文件保存到文档目录.

以下是选择和保存到文档目录的代码

//code to click on music button
- (IBAction)addMusic:(id)sender
{
    MPMediaPickerController *soundPicker=[[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
    soundPicker.delegate=self;
    soundPicker.allowsPickingMultipleItems=NO;
    [self presentViewController:soundPicker animated:YES completion:nil];
}

- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
    NSLog(@"music files delegate called");
    MPMediaItem *item = [[mediaItemCollection items] objectAtIndex:0];
    [self uploadMusicFile:item];
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void) uploadMusicFile:(MPMediaItem *)song
{
    NSURL *url = [song valueForProperty: MPMediaItemPropertyAssetURL];

    AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL: url options:nil];

    AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset
                                                                      presetName:AVAssetExportPresetAppleM4A];

    exporter.outputFileType =   @"com.apple.m4a-audio";

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios avplayer

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

Pagecontrol手势与swrevealcontroller冲突?

我已经加入swrevealcontroller在表项的我app.On点击它会打开一个新的视图controller.I添加了一个的PageControl在该视图controller.So的第一次平移手势的PageControl的作品,但在接下来的时间平移手势不换页工作控制.请告诉我如何避免泛手势的冲突.

- (void)_handleRevealGesture:(UIPanGestureRecognizer *)recognizer
{
    NSLog(@"handle pan gesture");
    CGPoint velocity = [recognizer velocityInView:self.view]; if(velocity.x > 0)
    {
        NSLog(@"gesture went right");
    }
    else
    {
        NSLog(@"gesture went left");
        if(self.isReaveled)
        {
            switch ( recognizer.state )
            {


                case UIGestureRecognizerStateBegan:
                    [self _handleRevealGestureStateBeganWithRecognizer:recognizer];
                    break;

                case UIGestureRecognizerStateChanged:
                    [self _handleRevealGestureStateChangedWithRecognizer:recognizer];
                    break;

                case UIGestureRecognizerStateEnded:
                    [self _handleRevealGestureStateEndedWithRecognizer:recognizer];
                    break;

                case UIGestureRecognizerStateCancelled:
                    //case UIGestureRecognizerStateFailed:
                    [self _handleRevealGestureStateCancelledWithRecognizer:recognizer];
                    break;

                default:
                    break;
            }

        }
    }


}
Run Code Online (Sandbox Code Playgroud)

我已经修改了上面的代码以便工作,但它不起作用.

iphone objective-c ios swrevealviewcontroller

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

如何在swift 4中检测UILabel中的链接?

我使用ActiveLabel作为第三方库,在特定单词的标签中建立链接.代码适用于Swift 3和3.2.但不适用于swift 4.

我用的代码如下

let customType1 = ActiveType.custom(pattern: "\\sTerms & Conditions\\b") //Looks for "are"
            labelTc.enabledTypes.append(customType1)
            labelTc.customize { (label) in
                labelTc.text = "UserAgreement".localized
                label.numberOfLines = 0
                label.lineSpacing = 4
                label.textColor = UIColor(red: 131 / 255, green: 147 / 255, blue: 168 / 255, alpha: 1)
                //Custom types
                label.customColor[customType1] = Constant.AppColor.greenMeadow
                label.customSelectedColor[customType1] = Constant.AppColor.greenMeadow
                label.configureLinkAttribute = { (type, attributes, isSelected) in
                    var atts = attributes
                    switch type {
                    case customType1:
                        atts[NSAttributedStringKey.font._rawValue as String] = UIFont(name: self.labelTc.font.fontName, size: 15.0) …
Run Code Online (Sandbox Code Playgroud)

uilabel ios swift

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

在swift中的`becomeFirstResponder()`中发出问题

我有六个textfields.现在,如果我textfield的所有内容都已填满并点按任何内容textfield,则应始终将焦点放在第六位textfield并显示键盘.我尝试了下面的代码,但它没有显示keyboard,只有当我点击第六时才放焦点textfield.请告诉我这个问题是什么?

func textFieldDidBeginEditing(_ textField: UITextField) {
     textField.inputAccessoryView = emptyView
        if let textOneLength = textFieldOne.text?.length ,let textTwoLength = textFieldTwo.text?.length ,let textThreeLength = textFieldThree.text?.length , let textFourLength = textFieldFour.text?.length,let textFiveLength = textFieldFive.text?.length , let textSixLength = textFieldSix.text?.length {
            if (textOneLength > 0) && (textTwoLength > 0) && (textThreeLength > 0) && (textFourLength > 0) && (textFiveLength > 0) && (textSixLength > 0) {
                self.textFieldSix.becomeFirstResponder()
            } else if (textOneLength <= 0) …
Run Code Online (Sandbox Code Playgroud)

keyboard uitextfield ios uitextfielddelegate swift

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

从iOS应用上传youtube上的视频?

我想从我自己的应用程序上传Youtube上的视频,并在杀死应用程序后甚至在后台模式下恢复上传.我试过这个链接,但这是一个MacApp而不是iOS应用程序.此外,当我运行它时,它在pod文件中说NSURLSession在10.9或更新版本中可用.所以它似乎对我不起作用.

https://github.com/google/google-api-objectivec-client-for-rest/tree/master/Examples

任何人都可以指导我如何在一个更好,也许是一个简单的例子中实现这一目标.

编辑: 我已尝试下面的代码,我得到以下错误.请帮助我解决问题.

func postVideoToYT(videoData: Data, token: String,title:String,innoId:Int,videoTags:String,callback: @escaping (Bool) -> Void) {

        do {

            let headers = ["Authorization": "Bearer \(token)"]

            upload(multipartFormData: { multipartFormData in

                multipartFormData.append("{'snippet':{'title' : '\(title)','description': 'abc'}}".data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: "snippet", mimeType: "application/json")

                multipartFormData.append("{'status' : {'privacyStatus':'private'}}".data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: "status",mimeType: "application/json")

                multipartFormData.append(videoData, withName: "video", fileName: "video.mov", mimeType: "application/octet-stream")

            }, usingThreshold: 1, to: URL(string: "https://www.googleapis.com/upload/youtube/v3/videos?part=snippet&status")!, method: .post, headers: headers, encodingCompletion: { encodingResult in

                switch encodingResult {

                case .success(let upload, _, _):



                    upload.responseJSON { …
Run Code Online (Sandbox Code Playgroud)

xcode ios youtube-data-api swift

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

无法通过 macOS 中的 ansible 取消归档模块提取 tar 文件?

我编写了一个剧本,它下载 tar 文件并将其解压到 Mac 中的某个目录。但是当我运行该剧本时,它失败并出现以下错误

"msg": "无法找到 \"/Users/harmeet/.ansible/tmp/ansible-tmp-1549339698.75-251687957122076/config.tar9IXAUQ.gz\" 的处理程序。确保安装了提取文件所需的命令。命令“/usr/bin/tar”检测为 tar 类型 bsd。需要 GNU tar。命令“/usr/bin/unzip”无法处理存档。

剧本代码

-name: Download the tar for sample config 
unarchive:
 src: http://someremoteurl/config.tar.gz 
dest: /Users/{{ansible_user}}/.myfolder/ 
remote_src: yes 
creates: /Users/{{ansible_user}}/.myfolder/config
Run Code Online (Sandbox Code Playgroud)

如果在远程服务器上使用 zip 文件,例如http://someremoteurl/config.zip,则此任务可以工作,但对于 tar 文件则失败。

我还安装了 gnu tar 例如&在查看此问题gtar后更新了路径.bash_src

macos zip tar ansible

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

无法在 azure 应用服务中挂载卷?

我正在尝试通过 docker 容器在 azure 应用服务上部署 Node SDK。在我的 sdk 中,我已经安装了一个连接文件并为此编写了一个 docker-compose。但是当我通过 azure 部署它时,我得到以下错误。

InnerException: Docker.DotNet.DockerApiException, Docker API 响应状态码=InternalServerError, response={"message":"invalid volume specification: ':/usr/src/app/connection.json'"}

docker-compose.yml

version: '2'

services:
  node:
    container_name: node
    image: dhiraj1990/node-app:latest
    command: [ "npm", "start" ]
    ports:
      - "3000:3000"
    volumes:
      - ${WEBAPP_STORAGE_HOME}/site/wwwroot/connection.json:/usr/src/app/connection.json
Run Code Online (Sandbox Code Playgroud)

此路径中存在 connection.json /site/wwwroot

文件

FROM node:8

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm …
Run Code Online (Sandbox Code Playgroud)

azure amazon-web-services docker azure-app-service-plans

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

loopback4 中的自定义验证响应对象?

我在环回中的模型上添加了验证规则。验证工作正常,但我得到的响应消息在某种程度上是自动生成的。我需要根据验证发送自定义响应对象。

我的模型验证是 5 的乘数,如下所示

 @property({
    name: 'name',
    description: "The product's common name.",
    type: 'number',
    required: true,
    // Specify the JSON validation rules here
    jsonSchema: {
      multipleOf: 5
    },
  })
  counter: number;
Run Code Online (Sandbox Code Playgroud)

我收到如下验证消息

{
  "error": {
    "statusCode": 422,
    "name": "UnprocessableEntityError",
    "message": "The request body is invalid. See error object `details` property for more info.",
    "code": "VALIDATION_FAILED",
    "details": [
      {
        "path": ".counter",
        "code": "multipleOf",
        "message": "should be multiple of 5",
        "info": {
          "multipleOf": 5
        }
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我需要根据我的要求修改响应对象,我可以更新这个响应对象吗?

loopback typescript loopbackjs loopback4

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

如何在发布新消息之前删除rabbitmq中的特定消息?

我有一个订阅者将数据推送到队列中。现在消息看起来像这样

{
 "Content": {
   "_id" ""5ceya67bbsbag3",
   "dataset": { 
     "upper": {},
      "lower": {}

}
}
Run Code Online (Sandbox Code Playgroud)

现在可以使用相同的内容 id 推送新消息,但数据将不同。因此,我想删除具有相同 id 的旧消息或替换那些 id 相同的消息并仅保留最新消息。

我还没有在rabbitmq 中找到直接的解决方案。请指导我如何做到这一点?

我已经浏览了一些帖子。

发布 1

帖子 2

javascript message-queue amqp rabbitmq node.js

6
推荐指数
2
解决办法
547
查看次数