小编Lir*_*ira的帖子

在Swift中,Array [String]切片返回类型似乎不是[String]

我正在切割一个字符串数组并将其设置为[String]变量,但类型检查器正在抱怨.这是一个可能的编译器错误吗?

var tags = ["this", "is", "cool"]
tags[1..<3]
var someTags: [String] = tags[1..<3]
Run Code Online (Sandbox Code Playgroud)

截图

sub-array ios swift

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

使用Swift在iOS SDK中处理Facebook Graph API

我只是想从Facebook的Graph API请求数据,例如获取当前用户的基本信息.

Objective-C文档是:https://developers.facebook.com/docs/ios/graph#userinfo

[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
  if (!error) {

    /* My question: How do I read the contents of "result" in Swift? */

    // Success! Include your code to handle the results here
    NSLog(@"user info: %@", result);
  } else {
    // An error occurred, we need to handle the error
    // See: https://developers.facebook.com/docs/ios/errors   
  }
}];
Run Code Online (Sandbox Code Playgroud)

还没有Swift文档,我对类型为"id"的"result"参数感到困惑.

facebook-graph-api facebook-ios-sdk swift

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

获取GraphQL查询实时实时更新的计划是什么?

Facebook自己的产品使用GraphQL,也是实时体验的一个很好的例子.例如,当某人喜欢某事时,每个人都可以在他们的Feed中看到类似内容.

但是GraphQL的所有文档都使用无状态服务器,其中每个查询都像在单个时间点进行HTTP GET或HTTP POST.

因此,目前尚不清楚普通开发人员如何能够像Facebook本身一样实时构建.

例如,当我们有实时GraphQL时,服务器会跟踪什么样的状态?客户端是否会发送一堆GraphQL查询进行观察?或者服务器是否会跟踪客户端状态的更高级别,以推断客户端关注哪些GraphQL查询?

reactjs graphql

5
推荐指数
0
解决办法
574
查看次数

Firebase 3.0.1 Web API查询无效,导致iFrame安全性错误

我做了一个简单的电话ref.once('value', callback).回调永远不会被调用.

相反,我在Chrome控制台中收到此错误: Refused to display 'https://console.firebase.google.com/project/project6...redacted...73&parent=http%3A%2F%2Flocalhost%3A8204&pfname=&rpctoken=3...redacted...4' in a frame because it set 'X-Frame-Options' to 'DENY'.

我不知道这个iFrame是什么,或者这就是为什么我没有得到回调.FWIW,我正在运行我的开发应用程序localhost:8204

编辑:这是一个更全面的代码示例.

import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/database'

firebase.initializeApp({
  apiKey: config.firebaseApiKey,
  authDomain: `${config.firebaseAppName}.firebaseio.com`,
  databaseURL: `https://${config.firebaseAppName}.firebaseio.com`,
  storageBucket: config.firebaseStorageBucket
})

const ref = firebase.database().ref()

ref.once('value', callback)
Run Code Online (Sandbox Code Playgroud)

firebase

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