I'm trying to use parse locally (with MongoDB) with my iOS mobile app. I've installed node, mongo, parse, parse dashboard. I've created a pod file for my iOS project (XCode), installed parse with it. I put this code into the application didFinishLaunchingWithOptions method of the AppDelegate:
import Parse
Parse.enableLocalDatastore()
let parseConfig = ParseClientConfiguration {
$0.applicationId = "XXXXXXXXXX"
$0.clientKey = "YYYYYY"
$0.server = "http://(IP addr):(port)/parse"
}
Parse.initialize(with: parseConfig)
I'm starting mongoDB from the terminal and
the parse server also from the terminal:
--appId “XXXXXXXXXX” --clientKey "YYYYYY" --masterKey “ZZZZ” --databaseURI mongodb://localhost/parse
In my XCode app's viewController's viewDidLoad method I put this code:
import Parse
let gameScore = PFObject(className:"GameScore")
gameScore["score"] = 1337
gameScore["playerName"] = "Sean Plott"
gameScore["cheatMode"] = false
gameScore.saveInBackground {
(success: Bool, error: Error?) in
if (success) {
} else {
print("saveInBackground error: ", error!)
}
}
When I run my XCode swift app I get this error:
[Error]: unauthorized (Code: 0, Version: 1.17.2)
error: Error Domain=Parse Code=0 "unauthorized" UserInfo={error=unauthorized, NSLocalizedDescription=unauthorized, temporary=0}
This error comes from the saveInBackground Parse method. I also tried retrieving data from the parse server instead of saving, I got the same error:
let query = PFQuery(className:"GameScore")
query.whereKey("playerName", equalTo: "Michael Yabuti")
do {
let scoreArray = try query.findObjects()
print(scoreArray)
}
catch {
print("findObjects error: ", error)
}
From my parse dashboard I can see that the server is running, but no data is saved there from my mobile app
I've never done anything like this, please someone give me some pointers what the problem could be. Any help would be very much appreciated
MongoDB gives me this error:
AssertionException handling request, closing client connection: xxx SSL handshake received but server is started without SSL support
2019-02-13... I NETWORK [initandlisten] connection accepted from x.x.x.x:yyyy