我正在使用提供 OAuth2.0 身份验证的服务。这是我需要的步骤:
第三点是我的主要问题。
我已经使用微软库实现了 OAuth,一切正常。但我不能在这里使用它们,所以我正在尝试https://github.com/OAuthSwift/OAuthSwift这个。
这是我的代码:
private func authenticationService() {
// create an instance and retain it
let oauthswift = OAuth2Swift(
consumerKey: "xx",
consumerSecret: "xxx",
authorizeUrl: "//myurl + userId",
responseType: "token"
)
oauthswift.authorizeURLHandler = OAuthSwiftOpenURLExternally.sharedInstance
let handle = oauthswift.authorize(
withCallbackURL: "???",
scope: "", state:"") { result in
switch result {
case .success(let (credential, response, parameters)):
print(credential.oauthToken)
// Do your request
case .failure(let error):
print(error.localizedDescription)
}
}
}
Run Code Online (Sandbox Code Playgroud)
这可以正确打开我的 Safari,但随后我被重定向到哈希中包含访问令牌的 URI,但什么也没发生。 …
我有一个自定义的 usdz 文件(不是通过代码创建的,但比方说一把真正的椅子!)。我将其保存在Entity.
一旦我有了它,这就是我的代码:
func updateUIView(_ uiView: ARView, context: Context) {
if let modelEntity = model.modelEntity {
print("\(model.modelName)")
let anchorEntity = AnchorEntity(plane: .horizontal)
anchorEntity.addChild(modelEntity.clone(recursive: true))
uiView.scene.addAnchor(anchorEntity)
// modelEntity.generateCollisionShapes(recursive: true)
// If we have multiple object, recursive true help to generate collision for all of them
uiView.installGestures(.rotation, for: modelEntity as! Entity & HasCollision)
uiView.debugOptions = .showPhysics
} else {
print("Unable to load modelEntity for \(model.modelName)")
}
}
Run Code Online (Sandbox Code Playgroud)
这里的问题是“参数类型‘Entity’不符合预期类型‘HasCollision’”。所以我无法添加任何手势。
但我找不到任何有用的资源来实现我的最终目标。有什么建议吗?