因此,我设置了解析服务器,以便将用户信息保存在我正在开发的应用程序中。事情是,我已经创建了一个密钥对并访问了我的appid,masterkey和serverURL。我想用这个信息来连接通过Xcode的解析服务器内部AppDelegate.swift:从Xcode连接aws ec2实例和在Parse中创建对象?
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "appid"
ParseMutableClientConfiguration.clientKey = "masterkey"
ParseMutableClientConfiguration.server = "serverURL"
在资源:Info.plist中,我设置应用交通运输安全设置允许任意负载。在ViewController.swift中,我试图创建一个对象,xcode显示它已被保存。此外,我应该能够看到保存在我的解析仪表板对象:
import UIKit
import Parse
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let testObject = PFObject(className: "TestObject2")
testObject["foo"] = "bar"
testObject.saveInBackground { (success, error) -> Void in
print("Object has been saved.")
// added test for success 11th July 2016
if success {
print("Object has been saved.")
} else {
if error != nil {
print (error)
} else {
print ("Error")
}
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
当我运行代码,我没有看到该对象已保存在Xcode和没有在解析任何变化。
所以我想我会折回我的脚步,我注意到,相比于其他人我的serverURL是相当简单:
http://52.38.256.24:80/parse
而不是:
http://52.38.256.24.us-west-2.compute.amazonaws.com:80/parse
所以我继续,并添加了我看到其他人在网上有,但只是可以肯定的是,我试图重新访问我的serverURL。我开始通过打开终端并输入在此:
Seifs-Mac-mini:~ Seif$ cd Downloads/
Seifs-Mac-mini:Downloads Seif$ chmod 400 Spotyr_Key_Pair.pem
Seifs-Mac-mini:Downloads Seif$ ssh -v -i "Spotyr_Key_Pair.pem" [email protected]
这就造成了几个DEBUG1行结束:
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: Spotyr_Key_Pair.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
我也试过
chmod 600 Spotyr_Key_Pair.pem
没有成功。
在这一点上,我真的很困惑,甚至是什么问题。 Idk如果我正确连接实例开始,或者如果所有这些都不相关,并且问题在Xcode中。我注意到很多人有类似的问题,但我已经尝试了所有帮助他们没有成功的人。
我已经学会了很多尝试解决这个问题,但我仍然是一个新手。 我对这个极其冗长的问题表示歉意,但我正在努力为任何可能尝试回答我已经尝试过的东西的人节省时间。
任何建议都会有所帮助。
在此先感谢!