0

How can I use Parse to save a user's data without them having an account but still know which phone uploaded the content? For example, if a user uploads an image, how can I display that image back to only the person who uploaded it- all without requiring the user to create an account?

Thanks in advance for any help/direction!

2 Answers2

0

If it's all within a current user session an anonymous user may work for you: https://parse.com/docs/ios/guide#users-anonymous-users

Fred Faust
  • 6,696
  • 4
  • 32
  • 55
  • I've tried this but it seems like a new user is created each time the app is closed and reopened? I need to have it where the data is associated beyond just one session. –  Aug 09 '15 at 01:12
  • Anonymous parse users do not persist, maybe some form of the accepted answer and an anonymous user can give you what you need? – Fred Faust Aug 09 '15 at 10:21
0

You could use the Installations table in your data browser:

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
  // Store the deviceToken in the current Installation and save it to Parse
  let installation = PFInstallation.currentInstallation()
  installation.setDeviceTokenFromData(deviceToken)
  installation.saveInBackground()
}

That is how you link an installation to a device. You can then add a custom column to the Installation table in your data browser such as a File or array of images, whatever works for you.

Jacob
  • 2,338
  • 2
  • 22
  • 39
  • I think when the user remove the app and reinstall again will cause the old data to be lost, as AFAIK; device id is per app installation – Muhammad Hewedy Jul 28 '15 at 00:47
  • @MuhammadHewedy Any solution will have this problem unless the user creates an account. If the user deletes the app the only thing that can retrieve the information again is some form of login. – Jacob Jul 28 '15 at 00:48
  • Thanks a lot Jacob, exactly what I needed. –  Jul 28 '15 at 00:52
  • http://stackoverflow.com/questions/9180226/how-to-store-local-data-after-user-delete-my-ios-app – Muhammad Hewedy Jul 28 '15 at 00:54
  • @MuhammadHewedy Very interesting! I was unaware of the keychain, thanks for sharing. In theory, the OP could store the objectId's of the photos in the keychain and query for the objects if the user deletes and reinstalls the app. – Jacob Jul 28 '15 at 00:57