Skip to content

Commit 0a7839d

Browse files
author
Luz Caballero
committed
Comment cleanup.
1 parent 804f409 commit 0a7839d

File tree

7 files changed

+104
-23
lines changed

7 files changed

+104
-23
lines changed

FBGraphAPISample/FBGraphAPISample/GraphAPICallsViewController.m

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ @implementation GraphAPICallsViewController
2525

2626
// IMPORTANT NOTES:
2727

28-
/* In the API calls' error handling in this sample, we don't handle session
28+
/* This app doesn't do extensive error handling. To learn how to handle errors
29+
please visit our Error Handling guide: http://developers.facebook.com/docs/ios/errors */
30+
31+
/* In particular, in the API calls' error handling in this sample, we don't handle session
2932
closures that happen outside the app. If the session is closed outside the app or
3033
expires, when the user tries to make an API call by tapping a button, they will
3134
be shown an error message from [FBErrorUtility userMessageForError:error]
@@ -41,8 +44,6 @@ @implementation GraphAPICallsViewController
4144
the publish_actions permission if we weren't doing this we'd need to handle the
4245
FBErrorCategoryPermissions error. */
4346

44-
/* Depending on your app, you may need to do some extra error handling */
45-
4647
// ------------> Login code starts here <------------
4748

4849
- (void) viewDidLoad {

FBLoginCustomUISample/FBLoginCustomUISample/AppDelegate.m

+13-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
// Copyright (c) 2013 Facebook Inc. All rights reserved.
77
//
88

9+
/* This sample implements Login with Facebook using API calls and a custom button.
10+
It checks for a cached session when a person opens the app, and if there is one, it is opened.
11+
You can see the tutorial that accompanies this sample here:
12+
https://developers.facebook.com/docs/ios/login-tutorial/#login-apicalls
13+
14+
For simplicity, this sample does limited error handling. You can read more
15+
about handling errors in our Error Handling guide:
16+
https://developers.facebook.com/docs/ios/errors
17+
*/
18+
919
#import "AppDelegate.h"
1020

1121
@implementation AppDelegate
@@ -85,14 +95,14 @@ - (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state er
8595
alertText = @"Your current session is no longer valid. Please log in again.";
8696
[self showMessage:alertText withTitle:alertTitle];
8797

88-
// All other errors that can happen need retries
89-
// more info: https://github.com/facebook/facebook-ios-sdk/blob/master/src/FBError.h#L163
98+
// For simplicity, here we just show a generic message for all other errors
99+
// You can learn how to handle other errors using our guide: https://developers.facebook.com/docs/ios/errors
90100
} else {
91101
//Get more error information from the error
92102
NSDictionary *errorInformation = [[[error.userInfo objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"];
93103

94104
// Show the user an error message
95-
alertTitle = @"Something went wrong :S";
105+
alertTitle = @"Something went wrong";
96106
alertText = [NSString stringWithFormat:@"Please retry. \n\n If the problem persists contact us and mention this error code: %@", [errorInformation objectForKey:@"message"]];
97107
[self showMessage:alertText withTitle:alertTitle];
98108
}

FBLoginUIControlSample/FBLoginUIControlSample/LoginUIViewController.m

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
// Copyright (c) 2013 Facebook Inc. All rights reserved.
77
//
88

9+
/* This sample implements Login with Facebook using the standard Login button.
10+
It asks for the basic_info, email and user_likes permissions.
11+
You can see the tutorial that accompanies this sample here:
12+
https://developers.facebook.com/docs/ios/login-tutorial/#login-button
13+
14+
For simplicity, this sample does limited error handling. You can read more
15+
about handling errors in our Error Handling guide:
16+
https://developers.facebook.com/docs/ios/errors
17+
*/
18+
919
#import "LoginUIViewController.h"
1020

1121
@interface LoginUIViewController ()

FBOGSample/FBOGSample/OGShareViewController.m

+21-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
// Copyright (c) 2013 Facebook Inc. All rights reserved.
77
//
88

9+
/*
10+
11+
FBOGSample publishes an Open Graph (https://developers.facebook.com/products/open-graph/) story using Graph API calls.
12+
This app also implements Facebook Login and asks for the necessary permissions to post to Facebook on the user's behalf.
13+
Find the tutorial here: https://developers.facebook.com/docs/ios/open-graph)
14+
15+
For simplicity, this sample does limited error handling. You can read more
16+
about handling errors in our Error Handling guide:
17+
https://developers.facebook.com/docs/ios/errors
18+
*/
19+
920
#import "OGShareViewController.h"
1021

1122
@interface OGShareViewController ()
@@ -105,7 +116,8 @@ - (IBAction)shareOGStory:(id)sender
105116
}
106117

107118
} else {
108-
// An error occurred
119+
// An error occurred, we need to handle the error
120+
// See: https://developers.facebook.com/docs/ios/errors
109121
NSLog(@"Encountered an error requesting permissions: %@", error.description);
110122
}
111123
}];
@@ -116,7 +128,8 @@ - (IBAction)shareOGStory:(id)sender
116128
}
117129

118130
} else {
119-
// An error occurred
131+
// An error occurred, we need to handle the error
132+
// See: https://developers.facebook.com/docs/ios/errors
120133
NSLog(@"Encountered an error checking permissions: %@", error.description);
121134
}
122135
}];
@@ -193,19 +206,22 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
193206
cancelButtonTitle:@"OK!"
194207
otherButtonTitles:nil] show];
195208
} else {
196-
// An error occurred
209+
// An error occurred, we need to handle the error
210+
// See: https://developers.facebook.com/docs/ios/errors
197211
NSLog(@"Encountered an error posting to Open Graph: %@", error.description);
198212
}
199213
}];
200214

201215
} else {
202-
// An error occurred
216+
// An error occurred, we need to handle the error
217+
// See: https://developers.facebook.com/docs/ios/errors
203218
NSLog(@"Encountered an error posting to Open Graph: %@", error.description);
204219
}
205220
}];
206221

207222
} else {
208-
// An error occurred
223+
// An error occurred, we need to handle the error
224+
// See: https://developers.facebook.com/docs/ios/errors
209225
NSLog(@"Error staging an image: %@", error.description);
210226
}
211227
}];

FBOGSampleSD/FBOGSampleSD/OGShareViewController.m

+15-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
// Copyright (c) 2013 Facebook Inc. All rights reserved.
77
//
88

9+
/*
10+
11+
FBOGSampleSD publishes an Open Graph (https://developers.facebook.com/products/open-graph/) story using the Share Dialog.
12+
Find the tutorial here: https://developers.facebook.com/docs/ios/open-graph)
13+
14+
For simplicity, this sample does limited error handling. You can read more
15+
about handling errors in our Error Handling guide:
16+
https://developers.facebook.com/docs/ios/errors
17+
*/
18+
919
#import <FacebookSDK/FacebookSDK.h>
1020
#import "OGShareViewController.h"
1121

@@ -79,7 +89,8 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
7989
previewPropertyName:@"dish"
8090
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
8191
if(error) {
82-
// There was an error
92+
// An error occurred, we need to handle the error
93+
// See: https://developers.facebook.com/docs/ios/errors
8394
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
8495
} else {
8596
// Success
@@ -105,7 +116,8 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
105116
parameters:params
106117
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
107118
if (error) {
108-
// Error launching the dialog or publishing a story.
119+
// An error occurred, we need to handle the error
120+
// See: https://developers.facebook.com/docs/ios/errors
109121
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
110122
} else {
111123
if (result == FBWebDialogResultDialogNotCompleted) {
@@ -116,7 +128,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
116128
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
117129

118130
if (![urlParams valueForKey:@"post_id"]) {
119-
// User canceled.
131+
// User cancelled.
120132
NSLog(@"User cancelled.");
121133

122134
} else {

FBShareSample/FBShareSample/ShareViewController.m

+24-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
// Copyright (c) 2013 Facebook Inc. All rights reserved.
77
//
88

9+
/*
10+
FBShareSample shows how to publish a link and a status updates using both methods: the Share Dialog and Graph API calls.
11+
This sample also implements Login with Facebook. Login with Facebook is only needed to share using API calls.
12+
Find the tutorial [here](https://developers.facebook.com/docs/ios/share).
13+
14+
For simplicity, this sample does limited error handling. You can read more
15+
about handling errors in our Error Handling guide:
16+
https://developers.facebook.com/docs/ios/errors
17+
*/
18+
919
#import <FacebookSDK/FacebookSDK.h>
1020

1121
#import "ShareViewController.h"
@@ -109,7 +119,8 @@ - (IBAction)shareLinkWithShareDialog:(id)sender
109119
clientState:nil
110120
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
111121
if(error) {
112-
// There was an error
122+
// An error occurred, we need to handle the error
123+
// See: https://developers.facebook.com/docs/ios/errors
113124
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
114125
} else {
115126
// Success
@@ -135,7 +146,8 @@ - (IBAction)shareLinkWithShareDialog:(id)sender
135146
parameters:params
136147
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
137148
if (error) {
138-
// Error launching the dialog or publishing a story.
149+
// An error occurred, we need to handle the error
150+
// See: https://developers.facebook.com/docs/ios/errors
139151
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
140152
} else {
141153
if (result == FBWebDialogResultDialogNotCompleted) {
@@ -178,7 +190,8 @@ - (IBAction)postStatusUpdateWithShareDialog:(id)sender
178190
[FBDialogs presentShareDialogWithLink:nil
179191
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
180192
if(error) {
181-
// There was an error
193+
// An error occurred, we need to handle the error
194+
// See: https://developers.facebook.com/docs/ios/errors
182195
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
183196
} else {
184197
// Success
@@ -194,18 +207,19 @@ - (IBAction)postStatusUpdateWithShareDialog:(id)sender
194207
parameters:nil
195208
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
196209
if (error) {
197-
// Error launching the dialog or publishing a story.
210+
// An error occurred, we need to handle the error
211+
// See: https://developers.facebook.com/docs/ios/errors
198212
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
199213
} else {
200214
if (result == FBWebDialogResultDialogNotCompleted) {
201-
// User canceled.
215+
// User cancelled.
202216
NSLog(@"User cancelled.");
203217
} else {
204218
// Handle the publish feed callback
205219
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
206220

207221
if (![urlParams valueForKey:@"post_id"]) {
208-
// User canceled.
222+
// User cancelled.
209223
NSLog(@"User cancelled.");
210224

211225
} else {
@@ -310,7 +324,8 @@ - (void)makeRequestToShareLink {
310324
// Link posted successfully to Facebook
311325
NSLog([NSString stringWithFormat:@"result: %@", result]);
312326
} else {
313-
// There was an error
327+
// An error occurred, we need to handle the error
328+
// See: https://developers.facebook.com/docs/ios/errors
314329
NSLog([NSString stringWithFormat:@"%@", error.description]);
315330
}
316331
}];
@@ -379,7 +394,8 @@ - (void)makeRequestToUpdateStatus {
379394
// Status update posted successfully to Facebook
380395
NSLog([NSString stringWithFormat:@"result: %@", result]);
381396
} else {
382-
// There was an error
397+
// An error occurred, we need to handle the error
398+
// See: https://developers.facebook.com/docs/ios/errors
383399
NSLog([NSString stringWithFormat:@"%@", error.description]);
384400
}
385401
}];

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
ios-howtos
22
============
33

4-
Samples corresponding to the iOS tutorials.
4+
Samples corresponding to the iOS tutorials on http://developers.facebook.com
5+
6+
* FBGraphAPISample has example calls to the Graph API to request the user's information, request an object, post an object to the graph, stage an image using Facebook's image staging service, and delete an object. You can find the tutorial for this sample [here](https://developers.facebook.com/docs/ios/graph/).
7+
8+
* FBLoginCustomUISample implements Facebook Login using Graph API calls and a custom button. You can find the tutorial for this sample [here](https://developers.facebook.com/docs/ios/login-tutorial/#login-apicalls).
9+
10+
* FBLoginUIControlSample shows a simple login with Facebook using the standard Facebook Login button. You can find the tutorial for this sample [here](https://developers.facebook.com/docs/ios/login-tutorial/#login-button).
11+
12+
* FBOGSample publishes an [Open Graph](https://developers.facebook.com/products/open-graph/) story using Graph API calls. This app also implements Facebook Login and asks for the necessary permissions to post to Facebook on the user's behalf. Find the tutorial [here](https://developers.facebook.com/docs/ios/open-graph).
13+
14+
* FBOGSampleSD publishes an [Open Graph](https://developers.facebook.com/products/open-graph/) story using the Share Dialog. Find the tutorial [here](https://developers.facebook.com/docs/ios/open-graph).
15+
16+
* FBShareSample shows how to publish a link and a status updates using both methods: the Share Dialog and Graph API calls. Find the tutorial [here](https://developers.facebook.com/docs/ios/share).
17+
18+
19+
20+
521

622

0 commit comments

Comments
 (0)