小编amo*_*one的帖子

无法安装"iOS 6.1 Simulator"XCode 5

我想在模拟器ios6和ios7上运行我的应用程序.我正在尝试安装ios 6模拟器,但我收到此错误:

Failed to install "iOS 6.1 Simulator"
An unknown error occured. Please try again later.
Run Code Online (Sandbox Code Playgroud)

我重新启动了XCode,但没有工作.

ios-simulator ios6.1 xcode5

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

为什么不在浏览器上运行React生成版本?

我正在尝试使用react的构建工具构建我的反应应用程序.当我尝试"npm start"时,应用程序运行正常.

npm start
Run Code Online (Sandbox Code Playgroud)

http:// localhost:3000 =>我可以访问该应用程序.

在此输入图像描述

但是当我构建应用程序并尝试访问构建文件夹中的"index.html"文件时,它不起作用,我遇到了一个白色的空白屏幕.

npm run build
Run Code Online (Sandbox Code Playgroud)

http://myreact-app/build/index.html =>白色空白屏幕.

这是在运行npm run build之后创建的构建文件夹.

在此输入图像描述

这是index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link rel="manifest" href="/manifest.json">
    <link rel="shortcut icon" href="/favicon.ico">
    <title>React App</title>
    <link href="/static/css/main.9a0fe4f1.css" rel="stylesheet">
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript> 
    <div id="root"></div>
    <script type="text/javascript" src="/static/js/main.46d8cd76.js"></script>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?我无法访问我的apache Web服务器上构建的index.html文件?

reactjs

20
推荐指数
5
解决办法
3万
查看次数

AssertMacros:queueEntry错误-ios

这个错误是什么意思?

AssertMacros: queueEntry,  file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
AssertMacros: queueEntry,  file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
AssertMacros: queueEntry,  file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
AssertMacros: queueEntry,  file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
Run Code Online (Sandbox Code Playgroud)

启动应用程序时出现此错误

iphone objective-c ios

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

为什么我的应用程序未显示在iCloud Drive Folder中

iCloud Drive Folder不显示我的应用程序的文件夹.

这是我将文件发送到iCloud Drive的方式:

- (IBAction)btnStoreTapped:(id)sender {
    // Let's get the root directory for storing the file on iCloud Drive
    [self rootDirectoryForICloud:^(NSURL *ubiquityURL) {
        NSLog(@"1. ubiquityURL = %@", ubiquityURL);
        if (ubiquityURL) {

            // We also need the 'local' URL to the file we want to store
            //NSURL *localURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Photo" ofType:@"pdf"]];


            NSURL *localURL = [self localPathForResource:@"document" ofType:@"doc"];
            NSLog(@"2. localURL = %@", localURL);

            // Now, append the local filename to the ubiquityURL
            ubiquityURL = [ubiquityURL URLByAppendingPathComponent:localURL.lastPathComponent];
            NSLog(@"3. …
Run Code Online (Sandbox Code Playgroud)

ios icloud icloud-drive

14
推荐指数
3
解决办法
6511
查看次数

在ReactJS中卸载组件时取消承诺

我有一个名为"Item"的组件,它在挂载时创建并调用promise.

class Item extends React.Component{
    constructor(props){
        super(props)
        this.onClick = this.onClick.bind(this)

        this.prom = new Promise((resolve, reject) => {
            setTimeout(() => resolve("PROMISE COMPLETED "+this.props.id),6000)
        })
    }

    componentDidMount(){
        this.prom.then((success) => {
            console.log(success)
        })
    }

    componentWillUnmount(){
       console.log("unmounted")
    }

    onClick(e){
        e.preventDefault()
        this.props.remove(this.props.id)
    }

    render(){
        return (
            <h1>Item {this.props.id} - <a href="#" onClick={this.onClick}>Remove</a></h1>
        )
    }
}
Run Code Online (Sandbox Code Playgroud)

如您所见,promise在调用后6秒调用解析.

另一个名为"List"的组件负责在屏幕上显示这些项目."List"是"Item"组件的父级.

class List extends React.Component{
    constructor(props){
        super(props)
        this.state = {
            items : [1,2,3]
        }

        this.handleRemove = this.handleRemove.bind(this)
    }

    handleRemove(id){
        this.setState((prevState, props) => ({
            items : prevState.items.filter((cId) => cId != …
Run Code Online (Sandbox Code Playgroud)

promise cancellation reactjs

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

如何通过npm run-script将标志传递给nodejs应用程序?

我有一个NodeJS文件,我通过"npm"命令运行.我一直试图列出所有参数(包括标志).如果我通过直接调用节点exe来运行它,它工作正常,但如果我使用该npm命令,我无法访问标志.

码:

console.dir(process.argv);
Run Code Online (Sandbox Code Playgroud)

当我像这样运行文件时,

node file.js arg1 arg2 -f --flag2
Run Code Online (Sandbox Code Playgroud)

我可以得到所有的论据.

[ '/usr/local/bin/node',
  '/.../file.js',
  'arg1',
  'arg2',
  '-f',
  '--flag2' ]
Run Code Online (Sandbox Code Playgroud)

但是如果我将一个npm runner添加到package.json文件并尝试使用它运行,我只能获取参数而不是标志.

npm run test arg1 arg2 -f --flag2
Run Code Online (Sandbox Code Playgroud)

结果:

[ '/usr/local/bin/node',
  '/.../file.js',
  'arg1',
  'arg2' ]
Run Code Online (Sandbox Code Playgroud)

package.json文件:

{
  "name": "name",
  "version": "1.0.0",
  "description": "",
  "main": "test.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "test" : "node test.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
Run Code Online (Sandbox Code Playgroud)

基本上,节点不会将标志传递给正在运行的脚本.这有解决方案吗?我真正的项目有一个很长的路径,有很多参数,所以我想用一个快捷方式来测试它.

javascript json node.js package.json

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

AFNetworking后台文件上传

我想从我的应用程序上传文件到我的服务器.当应用处于活动状态时,以下代码效果很好.如果我按下主页按钮或打开另一个应用程序上传停止.

我激活了后台提取但仍然无法正常工作.

Afnetworking有后台支持,但我无法弄清楚如何将这个功能实现到我的代码中.

NSString *str=[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Archive.zip"];
NSDictionary *parameters = @{@"foo": @"bar"};
     NSURL *filePath = [NSURL fileURLWithPath:str];
    AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer];

    NSData *imageData=[NSData dataWithContentsOfURL:filePath];


    NSMutableURLRequest *request =
    [serializer multipartFormRequestWithMethod:@"POST" URLString:@"http://url"
                                    parameters:parameters
                     constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
                         [formData appendPartWithFileData:imageData
                                                     name:@"image"
                                                 fileName:@"Archive.zip"
                                                 mimeType:@"application/zip"];
                     }];


    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    AFHTTPRequestOperation *operation =
    [manager HTTPRequestOperationWithRequest:request
                                     success:^(AFHTTPRequestOperation *operation, id responseObject) {
                                         NSLog(@"Success %@", responseObject);
                                     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                         NSLog(@"Failure %@", error.description);
                                     }];


    [operation setUploadProgressBlock:^(NSUInteger __unused bytesWritten,
                                        long long …
Run Code Online (Sandbox Code Playgroud)

file-upload objective-c background-process afnetworking

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

如果supportsOnDeviceRecognition为true并且离线模式可用,SFSpeechRecognizer是否有限制?

根据苹果文件,可以发送的请求数量是有限制的SFSpeechRecognizer

准备好处理由语音识别限制引起的故障。由于语音识别是一项基于网络的服务,因此会实施限制,以便所有应用程序都可以免费使用该服务。单个设备每天可以执行的识别数量可能受到限制,并且每个应用程序可能会根据每天发出的请求数量进行全局限制。如果识别请求很快失败(启动后一两秒内),请检查识别服务是否变得不可用。如果是,您可能需要要求用户稍后重试。 https://developer.apple.com/documentation/speech/sfspeechrecognizer

另一份文档称,一台设备每小时可以发送 1000 个请求。

设备可以发出的 SFSpeechRecognitionRequest 调用数量的当前速率限制是每小时 1000 个请求。请注意,此限制是针对设备可以发出的请求数量,与发出请求的应用程序无关。这与请求相关的音频长度无关。对于给定的 SFSpeechRecognitionRequest,每个请求最多允许您播放一分钟的音频。

现在我正在创建一个SFSpeechRecognizer如下所示的属性,并检查supportsOnDeviceRecognition指示语音识别器是否可以在没有网络访问的情况下运行的属性。它在我安装了 iOS 13.2.3 的设备上返回true

let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))!
print(speechRecognizer.supportsOnDeviceRecognition) //true
Run Code Online (Sandbox Code Playgroud)

我尝试离线运行我的应用程序,在没有互联网连接的情况下它也可以正常工作。但目前尚不清楚是否仍有请求限制supportsOnDeviceRecognition。在这种情况下,SFSpeechRecognizer即使设备连接到互联网,也可能不会连接到 Apple 服务器,因为这是不必要的。supportsOnDeviceRecognition只有在正确的情况下才会有速率限制吗?

ios sirikit sfspeechrecognizer ios13

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

NSAttributedString到NSData没有'NSAttributedString'的可见@interface声明选择器'RTFDFromRange:documentAttributes:

我正在尝试转换NSAttributedStringNSData使用RTFDFromRange方法.得到这个:

No visible @interface for 'NSAttributedString' declares the selector 'RTFDFromRange:documentAttributes:
Run Code Online (Sandbox Code Playgroud)

我的代码出了什么问题?

NSAttributedString *val=self.textview.attributedText;
    NSData *data = [val RTFDFromRange:NSMakeRange(0, self.textview.text.length) documentAttributes:nil];
Run Code Online (Sandbox Code Playgroud)

nsattributedstring nsdata ios

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

为什么我的视图右上角有一个“加号”图标?

我正在尝试为我的LazyHGridview. 当我尝试将视图放到另一个视图上时,视图的右上角会显示绿色圆圈内的“加号”图标。

在此输入图像描述

struct TestView: View {
var d: GridData
  @Binding var list: [GridData]
  @State private var dragOver = false
   
  var body: some View {
    VStack {
      Text(String(d.id))
        .font(.headline)
        .foregroundColor(.white)
    }
    .frame(width: 160, height: 240)
    .background(colorPalette[d.id])
    .onDrag {
      let item = NSItemProvider(object: String(d.id) as NSString)
      item.suggestedName = String(d.id)
      return item
    }
    .onDrop(of: [UTType.text], isTargeted: $dragOver) { providers in
       
      return true
    }
    .border(Color(UIColor.label), width: dragOver ? 8 : 0)
  }
}
}
Run Code Online (Sandbox Code Playgroud)

swift swiftui

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