Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Documentation Revamp #650

Merged
merged 19 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions _includes/ios/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ file?.saveInBackground({ (success: Bool, error: Error?) in
```
</div>

You can delete files that are referenced by objects using the [REST API]({{ site.baseUrl }}/rest/guide/#deleting-files). You will need to provide the master key in order to be allowed to delete a file.
##Deleting Files

If your files are not referenced by any object in your app, it is not possible to delete them through the REST API. You may request a cleanup of unused files in your app's Settings page. Keep in mind that doing so may break functionality which depended on accessing unreferenced files through their URL property. Files that are currently associated with an object will not be affected.
If you know the name of a file you can delete it using the [REST API]({{site.baseUrl}}/rest/guide/#deleting-files). Your master key is required for this operation.

Note: Reguardless of the Parse Server storage configuration, deleting a `PFObject` with a `PFFileObject` does not delete the file itself meerly its reference. Additionally, Parse does **NOT** provide a way to find unreferenced file names in storage.
1 change: 1 addition & 0 deletions _includes/ios/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func application(application: UIApplication, didFinishLaunchingWithOptions launc
$0.server = "parseServerUrlString"
}
Parse.initialize(with: parseConfig)
return true
}
```
</div>
Expand Down
37 changes: 21 additions & 16 deletions _includes/ios/local-datastore.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Local Datastore

The Parse iOS/OS X SDK provides a local datastore which can be used to store and retrieve `PFObject`s, even when the network is unavailable. To enable this functionality, add `libsqlite3.dylib` and add `isLocalDatastoreEnabled = true` to the `ParseClientConfiguration` block used in `Parse.initialize()`.
The Parse iOS/OS X SDK provides a local datastore which can be used to store and retrieve `PFObject`s, even when the network is unavailable. To enable this functionality add `isLocalDatastoreEnabled = true` to the `ParseClientConfiguration` block used in `Parse.initialize()` or call `Parse.enableLocalDatastore()` prior to initializing Parse.

<div class="language-toggle" markdown="1">
```objective_c
@implementation AppDelegate

- (void)application:(UIApplication *)application didFinishLaunchWithOptions:(NSDictionary *)options {
[Parse enableLocalDatastore];
[Parse setApplicationId:@"parseAppId" clientKey:@"parseClientKey"];
ParseClientConfiguration *configuration = [ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
configuration.applicationId = @"parseAppId";
configuration.clientKey = @"parseClientKey";
configuration.server = @"parseServerUrlString";
configuration.localDatastoreEnabled = YES;
}];
[Parse initializeWithConfiguration:configuration];
}

@end
Expand Down Expand Up @@ -74,28 +79,28 @@ Storing objects is great, but it's only useful if you can then get the objects b
```objective_c
PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
[query fromLocalDatastore];
[[query getObjectInBackgroundWithId:@"xWMyZ4YE"] continueWithBlock:^id(BFTask *task) {
if (task.error) {
// Something went wrong.
return task;
}
[query getObjectInBackgroundWithId:"" block:^(PFObject * _Nullable object, NSError * _Nullable error) {
if (!error) {
// Success
} else {
// Fail!
}
}

// task.result will be your game score
return task;
}];
```

```swift
let query = PFQuery(className: "GameScore")
query.fromLocalDatastore()
query.getObjectInBackgroundWithId("xWMyZ4YE").continueWithBlock {
(task: BFTask!) -> AnyObject in
if let error = task.error {
// Something went wrong.
return task;
query.getObjectInBackground(withId: "string") { (object, error) in
if error == nil {
// Success!
} else {
// Failure!
}

// task.result will be your game score
return task;
}
```
</div>
Expand Down
Loading