所以,我正在尝试以编程方式创建一个sceneView
class ViewController: UIViewController, ARSCNViewDelegate {
var sceneView: ARSCNView = ARSCNView()
let configuration = ARWorldTrackingConfiguration()
override func viewDidLoad() {
super.viewDidLoad()
self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints, ARSCNDebugOptions.showWorldOrigin]
self.configuration.planeDetection = .horizontal
self.sceneView.session.run(configuration)
self.sceneView.delegate = self
self.sceneView.autoenablesDefaultLighting = true
//add autolayout contstraints
self.sceneView.translatesAutoresizingMaskIntoConstraints = false
self.sceneView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
self.sceneView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
self.sceneView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
self.sceneView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
}
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
guard anchor is ARPlaneAnchor else {return}
}
}
Run Code Online (Sandbox Code Playgroud)
但我收到此错误消息:
由于未捕获的异常'NSGenericException'而终止应用程序,原因:'无法使用锚点激活约束,因为它们没有共同的祖先.约束或其锚点是否引用不同视图层次结构中的项目?这是非法的.
这部分发生了\\add …
如何以编程方式添加 ARSCNView?如何设置宽度、高度和约束?
class ViewController: UIViewController {
var sceneView: ARSCNView!
let configuration = ARWorldTrackingConfiguration()
override func viewDidLoad() {
super.viewDidLoad()
self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints, ARSCNDebugOptions.showWorldOrigin]
self.sceneView.session.run(configuration)
}
}
Run Code Online (Sandbox Code Playgroud) 我在Rails 3中调用Rails控制台中的辅助方法,如下所示:
>> helper.my_method(parameter)
>> #=> some result
Run Code Online (Sandbox Code Playgroud)
但是,如果我更改辅助方法,则当我再次调用相同的方法时,不会反映更改.我必须exit运行rails console以便看到辅助方法的更改生效.
所以我刚刚迁移到 Rails 5.1.4,我试图让 Active Job 工作,但作业只是卡在队列中并且从未被处理。
sidekiq.yml
---
:verbose: true
:concurrency: 5
:timeout: 60
development:
:concurrency: 25
staging:
:concurrency: 50
production:
:concurrency: 5
:queues:
- default
- [high_priority, 2]
Run Code Online (Sandbox Code Playgroud)
sidekiq.rb
Sidekiq.configure_server do |config|
config.redis = {url: ENV['ACTIVE_JOB_URL'], network_timeout: 5}
end
Sidekiq.configure_client do |config|
config.redis = {url: ENV['ACTIVE_JOB_URL'], network_timeout: 5}
end
Run Code Online (Sandbox Code Playgroud)
以下是我从 Rails 控制台执行任务的方式:
TestJob.perform_later
Run Code Online (Sandbox Code Playgroud)
TestJob.rb内容:
class TestJob < ApplicationJob
queue_as :default
def perform(*args)
Rails.logger.debug "#{self.class.name}: I'm performing my job with arguments: #{args.inspect}"
end
end
Run Code Online (Sandbox Code Playgroud)
这些作业只是停留在队列中并且从未被处理:
我有一个由子域分隔的多租户网站。我网站上的每个用户都有自己的子域。这与 shopify、squarespace 等网站使用的模式相同:
mary.marketplacesite.com
matt.marketplacesite.com
john.marketplacesite.com
Run Code Online (Sandbox Code Playgroud)
用户还可以选择通过向我的反向代理服务器 (sites.marketplacesite.com) 提供 A 和 CNAME 记录来使用其自定义域。Shopify/Squarespace 有相同的确切说明:
https://help.shopify.com/manual/domains/connecting-existing-domains/setting-up-your-domain
完成此操作后,我必须手动将该站点添加到conf文件中:
server {
listen 80;
server_name www.mary.com mary.com;
location / {
access_log off;
proxy_pass http://mary.marketplacesite.com;
}
}
Run Code Online (Sandbox Code Playgroud)
这一切都有效,但这真的是 Shopify/Squarespace 对数千个网站所做的吗?他们如何自动更新代理服务器配置?有更好的方法吗?
我是否必须为每个自定义域创建一个服务器块?或者有一个脚本来生成该 .conf 文件并将其存储在“/etc/nginx/conf.d/”中?我也听说有Nginx+,但是有更便宜的方法吗?
arkit ×2
ios ×2
scenekit ×2
swift ×2
atom-editor ×1
game-physics ×1
helper ×1
html5-canvas ×1
nginx ×1
ruby ×1
sceneview ×1
sidekiq ×1