Permalink
Browse files

Facebook iOS SDK 3.9

Summary:
     see https://developers.facebook.com/ios/change-log-3.x/

Upgrading from 3.8
     https://developers.facebook.com/docs/ios/upgrading-from-3.8-to-3.9/

Reviewed By: jacl

Test Plan: Release Testing.

@update-submodule: vendor/OCMock
  • Loading branch information...
1 parent 6342e5f commit 5795d481154271cb451e4e30b373177922523fc9 @chrisp-fb chrisp-fb committed Oct 17, 2013
Showing with 3,477 additions and 3,254 deletions.
  1. +3 −2 samples/FriendPickerSample/FriendPickerSample/FPAppDelegate.h
  2. +2 −1 samples/FriendPickerSample/FriendPickerSample/FPAppDelegate.m
  3. +3 −1 samples/FriendPickerSample/FriendPickerSample/FPViewController.h
  4. +8 −7 samples/FriendPickerSample/FriendPickerSample/FPViewController.m
  5. +1 −1 samples/FriendPickerSample/FriendPickerSample/main.m
  6. +5 −5 samples/GraphApiSample/GraphApiSample/GraphApiAppDelegate.h
  7. +5 −3 samples/GraphApiSample/GraphApiSample/GraphApiAppDelegate.m
  8. +2 −2 samples/GraphApiSample/GraphApiSample/GraphApiViewController.h
  9. +18 −16 samples/GraphApiSample/GraphApiSample/GraphApiViewController.m
  10. +2 −2 samples/GraphApiSample/GraphApiSample/main.m
  11. +3 −2 samples/HelloFacebookSample/HelloFacebookSample/HFAppDelegate.h
  12. +8 −7 samples/HelloFacebookSample/HelloFacebookSample/HFAppDelegate.m
  13. +2 −1 samples/HelloFacebookSample/HelloFacebookSample/HFViewController.h
  14. +37 −36 samples/HelloFacebookSample/HelloFacebookSample/HFViewController.m
  15. +1 −1 samples/HelloFacebookSample/HelloFacebookSample/main.m
  16. +3 −2 samples/PlacePickerSample/PlacePickerSample/PPAppDelegate.h
  17. +2 −1 samples/PlacePickerSample/PlacePickerSample/PPAppDelegate.m
  18. +3 −2 samples/PlacePickerSample/PlacePickerSample/PPViewController.h
  19. +16 −15 samples/PlacePickerSample/PlacePickerSample/PPViewController.m
  20. +2 −2 samples/PlacePickerSample/PlacePickerSample/main.m
  21. +4 −4 samples/ProfilePictureSample/ProfilePictureSample/PPAppDelegate.h
  22. +8 −6 samples/ProfilePictureSample/ProfilePictureSample/PPAppDelegate.m
  23. +5 −4 samples/ProfilePictureSample/ProfilePictureSample/PPViewController.h
  24. +5 −5 samples/ProfilePictureSample/ProfilePictureSample/PPViewController.m
  25. +2 −2 samples/ProfilePictureSample/ProfilePictureSample/main.m
  26. +3 −2 samples/RPSSample/RPSSample/OGProtocols.h
  27. +4 −3 samples/RPSSample/RPSSample/RPSAppDelegate.h
  28. +8 −7 samples/RPSSample/RPSSample/RPSAppDelegate.m
  29. +2 −2 samples/RPSSample/RPSSample/RPSCommonObjects.m
  30. +3 −2 samples/RPSSample/RPSSample/RPSFriendsViewController.h
  31. +15 −14 samples/RPSSample/RPSSample/RPSFriendsViewController.m
  32. +2 −2 samples/RPSSample/RPSSample/RPSGameViewController.h
  33. +30 −27 samples/RPSSample/RPSSample/RPSGameViewController.m
  34. +2 −2 samples/RPSSample/RPSSample/main.m
  35. +5 −4 samples/Scrumptious/scrumptious/SCAppDelegate.h
  36. +17 −21 samples/Scrumptious/scrumptious/SCAppDelegate.m
  37. +3 −2 samples/Scrumptious/scrumptious/SCLoginViewController.h
  38. +8 −7 samples/Scrumptious/scrumptious/SCLoginViewController.m
  39. +3 −2 samples/Scrumptious/scrumptious/SCPhotoViewController.h
  40. +5 −5 samples/Scrumptious/scrumptious/SCPhotoViewController.m
  41. +3 −2 samples/Scrumptious/scrumptious/SCProtocols.h
  42. +4 −3 samples/Scrumptious/scrumptious/SCViewController.h
  43. +121 −123 samples/Scrumptious/scrumptious/SCViewController.m
  44. +6 −5 samples/SessionLoginSample/SessionLoginSample/SLAppDelegate.h
  45. +9 −9 samples/SessionLoginSample/SessionLoginSample/SLAppDelegate.m
  46. +2 −2 samples/SessionLoginSample/SessionLoginSample/SLViewController.h
  47. +23 −22 samples/SessionLoginSample/SessionLoginSample/SLViewController.m
  48. +4 −2 samples/SwitchUserSample/SwitchUserSample/SUAppDelegate.h
  49. +6 −5 samples/SwitchUserSample/SwitchUserSample/SUAppDelegate.m
  50. +1 −1 samples/SwitchUserSample/SwitchUserSample/SUProfileTableViewCell.h
  51. +10 −9 samples/SwitchUserSample/SwitchUserSample/SUProfileTableViewCell.m
  52. +1 −1 samples/SwitchUserSample/SwitchUserSample/SUSettingsViewController.h
  53. +35 −33 samples/SwitchUserSample/SwitchUserSample/SUSettingsViewController.m
  54. +2 −1 samples/SwitchUserSample/SwitchUserSample/SUUserManager.h
  55. +16 −15 samples/SwitchUserSample/SwitchUserSample/SUUserManager.m
  56. +1 −1 samples/SwitchUserSample/SwitchUserSample/SUUsingViewController.h
  57. +14 −12 samples/SwitchUserSample/SwitchUserSample/SUUsingViewController.m
  58. +1 −1 samples/SwitchUserSample/SwitchUserSample/main.m
  59. +25 −12 scripts/build_distribution.sh
  60. +1 −1 scripts/build_documentation.sh
  61. +2 −8 scripts/common.sh
  62. +27 −0 scripts/productbuild_distribution.xml
  63. +1 −0 src/FBAccessTokenData+Internal.h
  64. +16 −15 src/FBAccessTokenData.h
  65. +12 −11 src/FBAccessTokenData.m
  66. +2 −1 src/FBAppBridge.h
  67. +52 −51 src/FBAppBridge.m
  68. +4 −4 src/FBAppBridgeTypeToJSONConverter.h
  69. +12 −10 src/FBAppBridgeTypeToJSONConverter.m
  70. +2 −2 src/FBAppCall+Internal.h
  71. +37 −36 src/FBAppCall.h
  72. +54 −53 src/FBAppCall.m
  73. +75 −96 src/FBAppEvents.h
  74. +172 −175 src/FBAppEvents.m
  75. +1 −1 src/FBAppLinkData+Internal.h
  76. +2 −2 src/FBAppLinkData.h
  77. +7 −6 src/FBAppLinkData.m
  78. +5 −4 src/FBCacheDescriptor.h
  79. +1 −1 src/FBCacheDescriptor.m
  80. +8 −7 src/FBCacheIndex.h
  81. +146 −145 src/FBCacheIndex.m
  82. +3 −3 src/FBConnect.h
  83. +2 −1 src/FBDataDiskCache.h
  84. +34 −33 src/FBDataDiskCache.m
  85. +4 −4 src/FBDialog.h
  86. +92 −90 src/FBDialog.m
  87. +5 −5 src/FBDialogs+Internal.h
  88. +86 −85 src/FBDialogs.h
  89. +34 −33 src/FBDialogs.m
  90. +1 −1 src/FBDialogsData+Internal.h
  91. +1 −1 src/FBDialogsData.h
  92. +3 −3 src/FBDialogsData.m
  93. +1 −1 src/FBDialogsParams+Internal.h
  94. +2 −2 src/FBDialogsParams.h
  95. +1 −1 src/FBDialogsParams.m
  96. +17 −16 src/FBDynamicFrameworkLoader.h
  97. +5 −3 src/FBDynamicFrameworkLoader.m
  98. +35 −35 src/FBError.h
  99. +1 −1 src/FBError.m
  100. +6 −6 src/FBErrorUtility.h
  101. +18 −17 src/FBErrorUtility.m
  102. +4 −4 src/FBFetchedAppSettings.h
  103. +4 −3 src/FBFetchedAppSettings.m
  104. +1 −1 src/FBFrictionlessDialogSupportDelegate.h
  105. +14 −13 src/FBFrictionlessRecipientCache.h
  106. +12 −11 src/FBFrictionlessRecipientCache.m
  107. +5 −5 src/FBFrictionlessRequestSettings.h
  108. +17 −16 src/FBFrictionlessRequestSettings.m
  109. +16 −15 src/FBFriendPickerCacheDescriptor.h
  110. +13 −12 src/FBFriendPickerCacheDescriptor.m
  111. +4 −3 src/FBFriendPickerViewController+Internal.h
  112. +41 −40 src/FBFriendPickerViewController.h
  113. +48 −47 src/FBFriendPickerViewController.m
  114. +7 −6 src/FBGraphLocation.h
  115. +37 −37 src/FBGraphObject.h
  116. +44 −42 src/FBGraphObject.m
  117. +6 −5 src/FBGraphObjectPagingLoader.h
  118. +34 −30 src/FBGraphObjectPagingLoader.m
  119. +1 −1 src/FBGraphObjectTableCell.h
  120. +16 −16 src/FBGraphObjectTableCell.m
  121. +4 −3 src/FBGraphObjectTableDataSource.h
  122. +51 −50 src/FBGraphObjectTableDataSource.m
  123. +3 −2 src/FBGraphObjectTableSelection.h
  124. +18 −17 src/FBGraphObjectTableSelection.m
  125. +7 −6 src/FBGraphPlace.h
  126. +12 −11 src/FBGraphUser.h
  127. +1 −1 src/FBImageResourceLoader.h
  128. +2 −1 src/FBImageResourceLoader.m
  129. +4 −3 src/FBInsights.h
  130. +5 −3 src/FBInsights.m
  131. +6 −6 src/FBLogger.h
  132. +27 −26 src/FBLogger.m
  133. +1 −1 src/FBLoginDialog.h
  134. +14 −13 src/FBLoginDialog.m
  135. +2 −1 src/FBLoginDialogParams.h
  136. +13 −12 src/FBLoginDialogParams.m
  137. +28 −27 src/FBLoginView.h
  138. +55 −81 src/FBLoginView.m
  139. +7 −6 src/FBNativeDialogs.h
  140. +13 −12 src/FBNativeDialogs.m
  141. +7 −6 src/FBOpenGraphAction.h
  142. +5 −4 src/FBOpenGraphActionShareDialogParams.h
  143. +3 −3 src/FBOpenGraphActionShareDialogParams.m
  144. +6 −5 src/FBOpenGraphObject.h
  145. +5 −4 src/FBPlacePickerCacheDescriptor.h
  146. +11 −10 src/FBPlacePickerCacheDescriptor.m
  147. +6 −5 src/FBPlacePickerViewController+Internal.h
  148. +31 −30 src/FBPlacePickerViewController.h
  149. +15 −15 src/FBProfilePictureView.h
  150. +37 −36 src/FBProfilePictureView.m
  151. +1 −1 src/FBRequest+Internal.h
  152. +69 −68 src/FBRequest.h
  153. +25 −23 src/FBRequest.m
  154. +2 −1 src/FBRequestBody.h
  155. +2 −1 src/FBRequestBody.m
  156. +110 −109 src/FBRequestConnection.h
  157. +122 −121 src/FBRequestConnection.m
  158. +2 −2 src/FBRequestConnectionRetryManager.h
  159. +7 −6 src/FBRequestConnectionRetryManager.m
  160. +16 −0 src/FBRequestHandlerFactory.h
  161. +32 −14 src/FBRequestHandlerFactory.m
  162. +6 −5 src/FBRequestMetadata.m
  163. +17 −1 src/FBSDKVersion.h
  164. +6 −6 src/FBSession+Internal.h
  165. +1 −1 src/FBSession+Protected.h
  166. +151 −138 src/FBSession.h
  167. +203 −185 src/FBSession.m
  168. +8 −7 src/FBSessionAppEventsState.m
  169. +8 −7 src/FBSessionAppSwitchingLoginStategy.m
  170. +3 −2 src/FBSessionAuthLogger.h
  171. +11 −10 src/FBSessionAuthLogger.m
  172. +1 −1 src/FBSessionFacebookAppNativeLoginStategy.h
  173. +6 −5 src/FBSessionFacebookAppNativeLoginStategy.m
  174. +2 −1 src/FBSessionFacebookAppWebLoginStategy.m
  175. +3 −2 src/FBSessionInlineWebViewLoginStategy.m
  176. +5 −5 src/FBSessionLoginStrategy.h
  177. +1 −1 src/FBSessionManualTokenCachingStrategy.m
  178. +1 −1 src/FBSessionSafariLoginStategy.h
  179. +2 −1 src/FBSessionSafariLoginStategy.m
  180. +6 −5 src/FBSessionSystemLoginStategy.m
  181. +21 −20 src/FBSessionTokenCachingStrategy.h
  182. +8 −7 src/FBSessionTokenCachingStrategy.m
  183. +10 −9 src/FBSessionUtility.m
  184. +4 −4 src/FBSettings+Internal.h
  185. +60 −42 src/FBSettings.h
  186. +33 −13 src/FBSettings.m
  187. +8 −7 src/FBShareDialogParams.h
  188. +2 −2 src/FBShareDialogParams.m
  189. +5 −4 src/FBSystemAccountStoreAdapter.h
  190. +18 −17 src/FBSystemAccountStoreAdapter.m
  191. +2 −2 src/FBTask+Private.h
  192. +2 −2 src/FBTask.h
  193. +7 −7 src/FBTask.m
  194. +2 −2 src/FBTaskCompletionSource.h
  195. +3 −3 src/FBTaskCompletionSource.m
  196. +1 −1 src/FBTestSession+Internal.h
  197. +21 −21 src/FBTestSession.h
  198. +96 −111 src/FBTestSession.m
  199. +1 −1 src/FBURLConnection.h
  200. +25 −24 src/FBURLConnection.m
  201. +9 −8 src/FBUserSettingsViewController.h
  202. +33 −31 src/FBUserSettingsViewController.m
  203. +5 −4 src/FBUtility.h
  204. +1 −1 src/FBUtility.m
  205. +1 −1 src/FBViewController+Internal.h
  206. +11 −11 src/FBViewController.h
  207. +2 −1 src/FBViewController.m
Sorry, we could not display the entire diff because it was too big.
View
5 samples/FriendPickerSample/FriendPickerSample/FPAppDelegate.h
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,11 +15,12 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
// Friend Picker sample application
//
-// The purpose of this sample application is to provide a very simple
+// The purpose of this sample application is to provide a very simple
// example of the FBFriendPickerViewController, without other bells and
// whistles to destract from the widget. This is a single-view application
// with simplistic authentication with Facebook. The view-controller for
View
3 samples/FriendPickerSample/FriendPickerSample/FPAppDelegate.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
*/
#import "FPAppDelegate.h"
+
#import "FPViewController.h"
@implementation FPAppDelegate
View
4 samples/FriendPickerSample/FriendPickerSample/FPViewController.h
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,6 +16,8 @@
#import <UIKit/UIKit.h>
+#import <FacebookSDK/FacebookSDK.h>
+
@interface FPViewController : UIViewController<FBFriendPickerDelegate>
- (IBAction)pickFriendsButtonClick:(id)sender;
View
15 samples/FriendPickerSample/FriendPickerSample/FPViewController.m
@@ -6,22 +6,23 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#import "FPAppDelegate.h"
#import "FPViewController.h"
+#import "FPAppDelegate.h"
+
// FBSample logic
// We need to handle some of the UX events related to friend selection, and so we declare
// that we implement the FBFriendPickerDelegate here; the delegate lets us filter the view
// as well as handle selection events
-@interface FPViewController ()
+@interface FPViewController ()
@property (strong, nonatomic) IBOutlet UITextView *selectedFriendsView;
@property (retain, nonatomic) FBFriendPickerViewController *friendPickerController;
@@ -44,7 +45,7 @@ - (void)viewDidLoad {
- (void)viewDidUnload {
self.selectedFriendsView = nil;
self.friendPickerController = nil;
-
+
[super viewDidUnload];
}
@@ -89,7 +90,7 @@ - (IBAction)pickFriendsButtonClick:(id)sender {
- (void)facebookViewControllerDoneWasPressed:(id)sender {
NSMutableString *text = [[NSMutableString alloc] init];
-
+
// we pick up the users from the selection, and create a string that we use to update the text view
// at the bottom of the display; note that self.selection is a property inherited from our base class
for (id<FBGraphUser> user in self.friendPickerController.selection) {
@@ -98,7 +99,7 @@ - (void)facebookViewControllerDoneWasPressed:(id)sender {
}
[text appendString:user.name];
}
-
+
[self fillTextBoxAndDismiss:text.length > 0 ? text : @"<None>"];
}
@@ -108,7 +109,7 @@ - (void)facebookViewControllerCancelWasPressed:(id)sender {
- (void)fillTextBoxAndDismiss:(NSString *)text {
self.selectedFriendsView.text = text;
-
+
[self dismissModalViewControllerAnimated:YES];
}
View
2 samples/FriendPickerSample/FriendPickerSample/main.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
10 samples/GraphApiSample/GraphApiSample/GraphApiAppDelegate.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
// Just Request sample application
//
-// The purpose of this sample application is to provide an example of
-// how to request data and entities from Facebook. The goal of the sample
-// is to show how to use the FBRequest and FBSession classes for this purpose,
+// The purpose of this sample application is to provide an example of
+// how to request data and entities from Facebook. The goal of the sample
+// is to show how to use the FBRequest and FBSession classes for this purpose,
// with minimal additional sample functionality to distract from the core topic.
@class GraphApiViewController;
View
8 samples/GraphApiSample/GraphApiSample/GraphApiAppDelegate.m
@@ -4,18 +4,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#import <FacebookSDK/FacebookSDK.h>
#import "GraphApiAppDelegate.h"
+
+#import <FacebookSDK/FacebookSDK.h>
+
#import "GraphApiViewController.h"
@implementation GraphApiAppDelegate
View
4 samples/GraphApiSample/GraphApiSample/GraphApiViewController.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
34 samples/GraphApiSample/GraphApiSample/GraphApiViewController.m
@@ -4,19 +4,21 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#import "GraphApiViewController.h"
+
#import <FacebookSDK/FacebookSDK.h>
+
#import "GraphApiAppDelegate.h"
-#import "GraphApiViewController.h"
static NSString *loadingText = @"Loading...";
@@ -111,40 +113,40 @@ - (void)sendRequests {
if ([self.textObjectID isFirstResponder]) {
[self.textObjectID resignFirstResponder];
}
-
+
// create the connection object
FBRequestConnection *newConnection = [[FBRequestConnection alloc] init];
-
+
// for each fbid in the array, we create a request object to fetch
// the profile, along with a handler to respond to the results of the request
for (NSString *fbid in fbids) {
-
+
// create a handler block to handle the results of the request for fbid's profile
FBRequestHandler handler =
^(FBRequestConnection *connection, id result, NSError *error) {
// output the results of the request
[self requestCompleted:connection forFbID:fbid result:result error:error];
};
-
+
// create the request object, using the fbid as the graph path
// as an alternative the request* static methods of the FBRequest class could
// be used to fetch common requests, such as /me and /me/friends
FBRequest *request = [[FBRequest alloc] initWithSession:FBSession.activeSession
graphPath:fbid];
-
+
// add the request to the connection object, if more than one request is added
// the connection object will compose the requests as a batch request; whether or
// not the request is a batch or a singleton, the handler behavior is the same,
// allowing the application to be dynamic in regards to whether a single or multiple
// requests are occuring
[newConnection addRequest:request completionHandler:handler];
}
-
+
// if there's an outstanding connection, just cancel
- [self.requestConnection cancel];
-
+ [self.requestConnection cancel];
+
// keep track of our connection, and start it
- self.requestConnection = newConnection;
+ self.requestConnection = newConnection;
[newConnection start];
}
@@ -159,7 +161,7 @@ - (void)requestCompleted:(FBRequestConnection *)connection
connection != self.requestConnection) {
return;
}
-
+
// clean this up, for posterity
self.requestConnection = nil;
@@ -177,11 +179,11 @@ - (void)requestCompleted:(FBRequestConnection *)connection
// we pull the name property out, if there is one, and display it
text = (NSString *)[dictionary objectForKey:@"name"];
}
-
+
self.textOutput.text = [NSString stringWithFormat:@"%@%@: %@\r\n",
- self.textOutput.text,
+ self.textOutput.text,
[fbID stringByTrimmingCharactersInSet:
- [NSCharacterSet whitespaceAndNewlineCharacterSet]],
+ [NSCharacterSet whitespaceAndNewlineCharacterSet]],
text];
}
View
4 samples/GraphApiSample/GraphApiSample/main.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
5 samples/HelloFacebookSample/HelloFacebookSample/HFAppDelegate.h
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,11 +15,12 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
// Hello Facebook sample application
//
-// The purpose of this sample application is show how to use Facebook to
+// The purpose of this sample application is show how to use Facebook to
// personalize an application experience and perform a set of typical actions.
// These include:
// - managing login and logout using FBSession
View
15 samples/HelloFacebookSample/HelloFacebookSample/HFAppDelegate.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,9 +16,10 @@
#import "HFAppDelegate.h"
-#import "HFViewController.h"
#import <FacebookSDK/FacebookSDK.h>
+#import "HFViewController.h"
+
@implementation HFAppDelegate
@synthesize window = _window;
@@ -51,25 +52,25 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// Nib files require the type to have been loaded before they can do the wireup successfully.
// http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
// [FBProfilePictureView class];
-
+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.window.rootViewController = [[HFViewController alloc] initWithNibName:@"HFViewController_iPhone" bundle:nil];
} else {
self.window.rootViewController = [[HFViewController alloc] initWithNibName:@"HFViewController_iPad" bundle:nil];
}
-
+
[self.window makeKeyAndVisible];
-
+
return YES;
}
-- (void)applicationDidBecomeActive:(UIApplication *)application {
+- (void)applicationDidBecomeActive:(UIApplication *)application {
// FBSample logic
// Call the 'activateApp' method to log an app event for use in analytics and advertising reporting.
[FBAppEvents activateApp];
-
+
// FBSample logic
// We need to properly handle activation of the application with regards to SSO
// (e.g., returning from iOS 6.0 authorization dialog or from fast app switching).
View
3 samples/HelloFacebookSample/HelloFacebookSample/HFViewController.h
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
@interface HFViewController : UIViewController
View
73 samples/HelloFacebookSample/HelloFacebookSample/HFViewController.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,9 +16,10 @@
#import "HFViewController.h"
-#import "HFAppDelegate.h"
#import <CoreLocation/CoreLocation.h>
+#import "HFAppDelegate.h"
+
@interface HFViewController () <FBLoginViewDelegate>
@@ -56,10 +57,10 @@ @implementation HFViewController
- (void)viewDidLoad {
[super viewDidLoad];
-
+
// Create Login View so that the app will be granted "status_update" permission.
FBLoginView *loginview = [[FBLoginView alloc] init];
-
+
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
#ifdef __IPHONE_7_0
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@@ -71,9 +72,9 @@ - (void)viewDidLoad {
#endif
#endif
loginview.delegate = self;
-
+
[self.view addSubview:loginview];
-
+
[loginview sizeToFit];
}
@@ -136,10 +137,10 @@ - (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
self.buttonPostPhoto.enabled = NO;
self.buttonPickFriends.enabled = NO;
self.buttonPickPlace.enabled = NO;
-
+
// "Post Status" available when logged on and potentially when logged off. Differentiate in the label.
[self.buttonPostStatus setTitle:@"Post Status Update (Logged Off)" forState:self.buttonPostStatus.state];
-
+
self.profilePic.profileID = nil;
self.labelFirstName.text = nil;
self.loggedInUser = nil;
@@ -175,16 +176,16 @@ - (void) performPublishAction:(void (^)(void)) action {
} else {
action();
}
-
+
}
// Post Status Update button handler; will attempt different approaches depending upon configuration.
- (IBAction)postStatusUpdateClick:(UIButton *)sender {
// Post a status update to the user's feed via the Graph API, and display an alert view
// with the results or an error.
-
+
NSURL *urlToShare = [NSURL URLWithString:@"http://developers.facebook.com/ios"];
-
+
// This code demonstrates 3 different ways of sharing using the Facebook SDK.
// The first method tries to share via the Facebook app. This allows sharing without
// the user having to authorize your app, and is available as long as the user has the
@@ -197,7 +198,7 @@ - (IBAction)postStatusUpdateClick:(UIButton *)sender {
// The third method tries to share via a Graph API request. This does require the user
// to authorize your app. They must also grant your app publish permissions. This
// allows the app to publish without any user interaction.
-
+
// If it is available, we will first try to post using the share dialog in the Facebook app
FBAppCall *appCall = [FBDialogs presentShareDialogWithLink:urlToShare
name:@"Hello Facebook"
@@ -212,34 +213,34 @@ - (IBAction)postStatusUpdateClick:(UIButton *)sender {
NSLog(@"Success!");
}
}];
-
+
if (!appCall) {
// Next try to post using Facebook's iOS6 integration
BOOL displayedNativeDialog = [FBDialogs presentOSIntegratedShareDialogModallyFrom:self
initialText:nil
image:nil
url:urlToShare
handler:nil];
-
+
if (!displayedNativeDialog) {
// Lastly, fall back on a request for permissions and a direct post using the Graph API
[self performPublishAction:^{
NSString *message = [NSString stringWithFormat:@"Updating status for %@ at %@", self.loggedInUser.first_name, [NSDate date]];
-
+
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
-
+
connection.errorBehavior = FBRequestConnectionErrorBehaviorReconnectSession
| FBRequestConnectionErrorBehaviorAlertUser
| FBRequestConnectionErrorBehaviorRetry;
-
+
[connection addRequest:[FBRequest requestForPostStatusUpdate:message]
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
-
+
[self showAlert:message result:result error:error];
self.buttonPostStatus.enabled = YES;
}];
[connection start];
-
+
self.buttonPostStatus.enabled = NO;
}];
}
@@ -251,23 +252,23 @@ - (IBAction)postPhotoClick:(UIButton *)sender {
// Just use the icon image from the application itself. A real app would have a more
// useful way to get an image.
UIImage *img = [UIImage imageNamed:@"Icon-72@2x.png"];
-
+
[self performPublishAction:^{
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
connection.errorBehavior = FBRequestConnectionErrorBehaviorReconnectSession
| FBRequestConnectionErrorBehaviorAlertUser
| FBRequestConnectionErrorBehaviorRetry;
-
+
[connection addRequest:[FBRequest requestForUploadPhoto:img]
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
-
+
[self showAlert:@"Photo Post" result:result error:error];
if (FBSession.activeSession.isOpen) {
self.buttonPostPhoto.enabled = YES;
}
}];
[connection start];
-
+
self.buttonPostPhoto.enabled = NO;
}];
}
@@ -277,23 +278,23 @@ - (IBAction)pickFriendsClick:(UIButton *)sender {
FBFriendPickerViewController *friendPickerController = [[FBFriendPickerViewController alloc] init];
friendPickerController.title = @"Pick Friends";
[friendPickerController loadData];
-
+
// Use the modal wrapper method to display the picker.
[friendPickerController presentModallyFromViewController:self animated:YES handler:
^(FBViewController *sender, BOOL donePressed) {
-
+
if (!donePressed) {
return;
}
-
+
NSString *message;
-
+
if (friendPickerController.selection.count == 0) {
message = @"<No Friends Selected>";
} else {
-
+
NSMutableString *text = [[NSMutableString alloc] init];
-
+
// we pick up the users from the selection, and create a string that we use to update the text view
// at the bottom of the display; note that self.selection is a property inherited from our base class
for (id<FBGraphUser> user in friendPickerController.selection) {
@@ -304,7 +305,7 @@ - (IBAction)pickFriendsClick:(UIButton *)sender {
}
message = text;
}
-
+
[[[UIAlertView alloc] initWithTitle:@"You Picked:"
message:message
delegate:nil
@@ -320,20 +321,20 @@ - (IBAction)pickPlaceClick:(UIButton *)sender {
placePickerController.title = @"Pick a Seattle Place";
placePickerController.locationCoordinate = CLLocationCoordinate2DMake(47.6097, -122.3331);
[placePickerController loadData];
-
+
// Use the modal wrapper method to display the picker.
[placePickerController presentModallyFromViewController:self animated:YES handler:
^(FBViewController *sender, BOOL donePressed) {
-
+
if (!donePressed) {
return;
}
-
+
NSString *placeName = placePickerController.selection.name;
if (!placeName) {
placeName = @"<No Place Selected>";
}
-
+
[[[UIAlertView alloc] initWithTitle:@"You Picked:"
message:placeName
delegate:nil
@@ -347,7 +348,7 @@ - (IBAction)pickPlaceClick:(UIButton *)sender {
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
-
+
NSString *alertMsg;
NSString *alertTitle;
if (error) {
@@ -374,7 +375,7 @@ - (void)showAlert:(NSString *)message
}
alertTitle = @"Success";
}
-
+
if (alertTitle) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
View
2 samples/HelloFacebookSample/HelloFacebookSample/main.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
5 samples/PlacePickerSample/PlacePickerSample/PPAppDelegate.h
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,11 +15,12 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
// Place Picker sample application
//
-// The purpose of this sample application is to provide a very simple
+// The purpose of this sample application is to provide a very simple
// example of the FBPlacePickerViewController, without other bells and
// whistles to destract from the widget. This is a single-view application
// with simplistic authentication with Facebook. The view-controller for
View
3 samples/PlacePickerSample/PlacePickerSample/PPAppDelegate.m
@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
*/
#import "PPAppDelegate.h"
+
#import "PPViewController.h"
@implementation PPAppDelegate
View
5 samples/PlacePickerSample/PlacePickerSample/PPViewController.h
@@ -6,16 +6,17 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
+#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
@interface PPViewController : FBPlacePickerViewController <UISearchDisplayDelegate, UISearchBarDelegate>
View
31 samples/PlacePickerSample/PlacePickerSample/PPViewController.m
@@ -6,16 +6,18 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#import <FacebookSDK/FacebookSDK.h>
#import "PPViewController.h"
+
+#import <FacebookSDK/FacebookSDK.h>
+
#import "PPAppDelegate.h"
enum SampleLocation {
@@ -53,7 +55,7 @@ - (void)refresh {
if (FBSession.activeSession.isOpen) {
// Default to Seattle, this method calls loadData
[self searchDisplayController:nil shouldReloadTableForSearchScope:SampleLocationSeattle];
- } else {
+ } else {
// if the session isn't open, we open it here, which may cause UX to log in the user
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
@@ -76,7 +78,7 @@ - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldRe
switch (searchOption) {
case SampleLocationSeattle:
// FBSample logic
- // After setting the coordinates for the data we wish to fetch, we call loadData to initiate
+ // After setting the coordinates for the data we wish to fetch, we call loadData to initiate
// the actual network round-trip with Facebook; likewise for the other two locations
self.locationCoordinate = CLLocationCoordinate2DMake(47.6097, -122.3331);
[self loadData];
@@ -91,14 +93,14 @@ - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldRe
[self.locationManager startUpdatingLocation];
break;
}
-
+
// When startUpdatingLocation/loadData finish, we will reload then.
return NO;
}
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
// FBSample logic
- // When search text changes, we update the property on our base class, and then refetch data; the
+ // When search text changes, we update the property on our base class, and then refetch data; the
// Scrumptious sample shows a more complex implementation of this, where frequent updates are aggregated,
// and fetching happens on a timed basis to avoid becomming to chatty with the server; this sample takes
// a more simplistic approach
@@ -117,25 +119,25 @@ - (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)control
- (void)placePickerViewControllerSelectionDidChange:(FBPlacePickerViewController *)placePicker
{
// FBSample logic
- // Here we see a use of the FBGraphPlace protocol, where our code can use dot-notation to
+ // Here we see a use of the FBGraphPlace protocol, where our code can use dot-notation to
// select name and location data from the selected place
id<FBGraphPlace> place = placePicker.selection;
// Make sure that we don't show message when the same row is being clicked twice (to be deselected)
if(!place) {
return;
}
-
+
// we'll use logging to show the simple typed property access to place and location info
NSString *infoMessage = [NSString localizedStringWithFormat:@"place=%@\n city=%@, state=%@\n lat=%@\n long=%@\n",
place.name,
place.location.city,
place.location.state,
place.location.latitude,
place.location.longitude];
-
+
NSLog(@"%@", infoMessage);
-
+
// Sample action for place selection completed action
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Place selected"
message:infoMessage
@@ -148,7 +150,7 @@ - (void)placePickerViewControllerSelectionDidChange:(FBPlacePickerViewController
- (void)viewDidLoad
{
[super viewDidLoad];
-
+
// FBSample logic
// We are inheriting FBPlacePickerViewController, and so in order to handle events such
// as selection change, we set our base class' delegate property to self
@@ -162,7 +164,7 @@ - (void)viewDidLoad
setSelectedScopeButtonIndex:self.viewStateSearchScopeIndex];
[self.searchDisplayController.searchBar setText:self.viewStateSearchText];
[self.searchDisplayController setActive:self.viewStateSearchWasActive];
-
+
self.viewStateSearchText = nil;
}
@@ -188,14 +190,13 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
#pragma mark - Location Manager delegate
-- (void)locationManager:(CLLocationManager *)manager
- didUpdateToLocation:(CLLocation *)newLocation
+- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
if (newLocation.horizontalAccuracy < 100) {
// We wait for a precision of 100m and turn the GPS off
[self.locationManager stopUpdatingLocation];
self.locationManager = nil;
-
+
self.locationCoordinate = newLocation.coordinate;
[self loadData];
}
View
4 samples/PlacePickerSample/PlacePickerSample/main.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
8 samples/ProfilePictureSample/ProfilePictureSample/PPAppDelegate.h
@@ -4,21 +4,21 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#import <UIKit/UIKit.h>
// Profile Picture sample application
//
-// The purpose of this sample application is to provide an example of
+// The purpose of this sample application is to provide an example of
// how use the profile picture view to display a Facebook profile picture
@class PPViewController;
View
14 samples/ProfilePictureSample/ProfilePictureSample/PPAppDelegate.m
@@ -4,31 +4,33 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#import "PPAppDelegate.h"
-#import "PPViewController.h"
+
#import <FacebookSDK/FacebookSDK.h>
+#import "PPViewController.h"
+
@implementation PPAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// If you have not added the -ObjC linker flag, you may need to uncomment the following line because
- // Nib files require the type to have been loaded before they can do the wireup successfully.
+ // Nib files require the type to have been loaded before they can do the wireup successfully.
// http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
// [FBProfilePictureView class];
-
+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
View
9 samples/ProfilePictureSample/ProfilePictureSample/PPViewController.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,13 +15,14 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
@interface PPViewController : UIViewController
// FBSample logic
-// The views and view controllers in the SDK are designed to fit into your application in
-// a similar fashion to other framework and custom view classes; this is an example of a
+// The views and view controllers in the SDK are designed to fit into your application in
+// a similar fashion to other framework and custom view classes; this is an example of a
// typical outlet for the FBPriflePictureView
@property (retain, nonatomic) IBOutlet FBProfilePictureView *profilePictureView;
@property (retain, nonatomic) IBOutlet UIView *profilePictureOuterView;
View
10 samples/ProfilePictureSample/ProfilePictureSample/PPViewController.m
@@ -4,16 +4,16 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#import "PPViewController.h"
// FBSample logic
@@ -47,7 +47,7 @@
"MarioLopezExtra",
"108504145837165",
"dennishaskins",
- // Eighties bands that have been to Moscow
+ // Eighties bands that have been to Moscow
"7220821999",
"31938132882",
"108023262558391",
@@ -84,7 +84,7 @@ - (IBAction)showJasonProfile:(id)sender {
- (IBAction)showMichaelProfile:(id)sender {
// FBSample logic
- // This example and the one after it, in contrast to the prvious one,
+ // This example and the one after it, in contrast to the prvious one,
// uses a vanity name to indicate which profile picture to display
profilePictureView.profileID = @"michael.marucheck";
}
View
4 samples/ProfilePictureSample/ProfilePictureSample/main.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
5 samples/RPSSample/RPSSample/OGProtocols.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
*/
#import <Foundation/Foundation.h>
+
#import <FacebookSDK/FacebookSDK.h>
// FBSample logic
View
7 samples/RPSSample/RPSSample/RPSAppDelegate.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,11 +15,12 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
// Boolean OG (Rock the Logic!) sample application
//
-// The purpose of this sample application is to provide an example of
+// The purpose of this sample application is to provide an example of
// how to publish and read Open Graph actions with Facebook. The goal
// of the sample is to show how to use FBRequest, FBRequestConnection,
// and FBSession classes, as well as the FBOpenGraphAction protocol and
View
15 samples/RPSSample/RPSSample/RPSAppDelegate.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,8 +15,9 @@
*/
#import "RPSAppDelegate.h"
-#import "RPSGameViewController.h"
+
#import "RPSFriendsViewController.h"
+#import "RPSGameViewController.h"
@implementation RPSAppDelegate
@@ -35,7 +36,7 @@ - (void)applicationDidBecomeActive:(UIApplication *)application {
- (void)applicationWillTerminate:(UIApplication *)application {
// all good things must come to an end
- // this is a good idea because things may be hanging off the session, that need
+ // this is a good idea because things may be hanging off the session, that need
// releasing (completion block, etc.) and other components in the app may be awaiting
// close notification in order to do cleanup
[FBSession.activeSession close];
@@ -44,7 +45,7 @@ - (void)applicationWillTerminate:(UIApplication *)application {
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
-
+
#ifdef DEBUG
[FBSettings enableBetaFeature:FBBetaFeaturesOpenGraphShareDialog | FBBetaFeaturesShareDialog];
#endif
@@ -58,13 +59,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
viewControllerSettings = [[FBUserSettingsViewController alloc] init];
viewControllerSettings.title = @"Facebook Settings";
viewControllerSettings.tabBarItem.image = [UIImage imageNamed:@"second"];
-
+
self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewControllerGame];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
[FBSession openActiveSessionWithAllowLoginUI:NO];
-
+
return YES;
}
View
4 samples/RPSSample/RPSSample/RPSCommonObjects.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
5 samples/RPSSample/RPSSample/RPSFriendsViewController.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
*/
#import <UIKit/UIKit.h>
+
#import <FacebookSDK/FacebookSDK.h>
@interface RPSFriendsViewController : FBFriendPickerViewController
View
29 samples/RPSSample/RPSSample/RPSFriendsViewController.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,8 +15,9 @@
*/
#import "RPSFriendsViewController.h"
-#import "RPSAppDelegate.h"
+
#import "OGProtocols.h"
+#import "RPSAppDelegate.h"
@interface RPSFriendsViewController () <FBFriendPickerDelegate, UIAlertViewDelegate>
@@ -50,14 +51,14 @@ - (void)viewDidLoad {
- (void)refreshView {
[self loadData];
-
+
// we use frictionless requests, so let's get a cache and request the
// current list of frictionless friends before enabling the invite button
if (!self.friendCache) {
self.friendCache = [[FBFrictionlessRecipientCache alloc] init];
[self.friendCache prefetchAndCacheForSession:nil
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
-
+
self.inviteButton.enabled = YES;
}];
} else {
@@ -75,7 +76,7 @@ - (void)viewDidAppear:(BOOL)animated {
} else {
self.inviteButton.enabled = NO;
self.friendCache = nil;
-
+
// display the message that we have
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In with Facebook"
message:@"When you Log In with Facebook, you can view "
@@ -125,23 +126,23 @@ - (void)friendPickerViewControllerSelectionDidChange:(FBFriendPickerViewControll
- (BOOL)friendPickerViewController:(FBFriendPickerViewController *)friendPicker
shouldIncludeUser:(id <FBGraphUser>)user {
- return [[user objectForKey:@"installed"] boolValue];
+ return [[user objectForKey:@"installed"] boolValue];
}
#pragma mark - private methods
// FBSample logic
-// This is the workhorse method of this view. It updates the textView with the activity of a given user. It
+// This is the workhorse method of this view. It updates the textView with the activity of a given user. It
// accomplishes this by fetching the "throw" actions for the selected user.
- (void)updateActivityForID:(NSString *)fbid {
-
+
// keep track of the selction
self.fbidSelection = fbid;
// create a request for the "throw" activity
FBRequest *playActivity = [FBRequest requestForGraphPath:[NSString stringWithFormat:@"%@/fb_sample_rps:throw", fbid]];
[playActivity.parameters setObject:@"U" forKey:@"date_format"];
-
+
// this block is the one that does the real handling work for the requests
void (^handleBlock)(id) = ^(id<RPSGraphActionList> result) {
if (result) {
@@ -160,7 +161,7 @@ - (void)updateActivityForID:(NSString *)fbid {
}
return NSOrderedSame;
}];
-
+
NSMutableString *output = [NSMutableString string];
for (id<RPSGraphPublishedThrowAction> entry in activity) {
NSDateComponents *c = [[NSCalendar currentCalendar]
@@ -176,7 +177,7 @@ - (void)updateActivityForID:(NSString *)fbid {
}
self.activityTextView.text = output;
};
-
+
// this is an example of a batch request using FBRequestConnection; we accomplish this by adding
// two request objects to the connection, and then calling start; note that each request handles its
// own response, despite the fact that the SDK is serializing them into a single request to the server
@@ -186,7 +187,7 @@ - (void)updateActivityForID:(NSString *)fbid {
handleBlock(result);
}];
// start the actual request
- [connection start];
+ [connection start];
}
- (IBAction)clickInviteFriends:(id)sender {
@@ -226,7 +227,7 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
me = nil;
}
}];
-
+
break;
}
}
View
4 samples/RPSSample/RPSSample/RPSGameViewController.h
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
View
57 samples/RPSSample/RPSSample/RPSGameViewController.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,12 +15,15 @@
*/
#import "RPSGameViewController.h"
-#import "RPSAppDelegate.h"
-#import <FacebookSDK/FacebookSDK.h>
+
+#import <AVFoundation/AVFoundation.h>
#import <QuartzCore/QuartzCore.h>
+
+#import <FacebookSDK/FacebookSDK.h>
+
#import "OGProtocols.h"
+#import "RPSAppDelegate.h"
#import "RPSFriendsViewController.h"
-#import <AVFoundation/AVFoundation.h>
typedef enum {
RPSCallNone = -1, RPSCallRock = 0, RPSCallPaper = 1, RPSCallScissors = 2 // enum is also used to index arrays
@@ -67,29 +70,29 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
if (self) {
self.title = NSLocalizedString(@"You Rock!", @"You Rock!");
self.tabBarItem.image = [UIImage imageNamed:@"first"];
-
+
BOOL ipad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
-
+
NSString *rockRight = ipad ? @"right-rock-128.png" : @"right-rock-88.png";
NSString *paperRight = ipad ? @"right-paper-128.png" : @"right-paper-88.png";
NSString *scissorsRight = ipad ? @"right-scissors-128.png" : @"right-scissors-88.png";
NSString *rockLeft = ipad ? @"left-rock-128.png" : @"left-rock-88.png";
NSString *paperLeft = ipad ? @"left-paper-128.png" : @"left-paper-88.png";
NSString *scissorsLeft = ipad ? @"left-scissors-128.png" : @"left-scissors-88.png";
-
+
_rightImages[RPSCallRock] = [UIImage imageNamed:rockRight];
_rightImages[RPSCallPaper] = [UIImage imageNamed:paperRight];
_rightImages[RPSCallScissors] = [UIImage imageNamed:scissorsRight];
-
+
_leftImages[RPSCallRock] = [UIImage imageNamed:rockLeft];
_leftImages[RPSCallPaper] = [UIImage imageNamed:paperLeft];
_leftImages[RPSCallScissors] = [UIImage imageNamed:scissorsLeft];
-
+
_imagesToPublish[RPSCallRock] = [UIImage imageNamed:@"left-rock-128.png"];
_imagesToPublish[RPSCallPaper] = [UIImage imageNamed:@"left-paper-128.png"];
_imagesToPublish[RPSCallScissors] = [UIImage imageNamed:@"left-scissors-128.png"];
-
+
_lastPlayerCall = _lastComputerCall = RPSCallNone;
_wins = _losses = _ties = 0;
_alertOkHandler = nil;
@@ -112,36 +115,36 @@ - (void)viewDidLoad {
[self.paperButton.layer setBorderColor:fontColor.CGColor];
self.paperButton.clipsToBounds = YES;
self.paperButton.tag = RPSCallPaper;
-
+
[self.scissorsButton.layer setCornerRadius:8.0];
[self.scissorsButton.layer setBorderWidth:4.0];
[self.scissorsButton.layer setBorderColor:fontColor.CGColor];
self.scissorsButton.clipsToBounds = YES;
self.scissorsButton.tag = RPSCallScissors;
-
+
[self.againButton.layer setCornerRadius:8.0];
[self.againButton.layer setBorderWidth:4.0];
[self.againButton.layer setBorderColor:fontColor.CGColor];
-
+
[self.computerHand.layer setCornerRadius:8.0];
self.computerHand.layer.shadowColor = [UIColor blackColor].CGColor;
self.computerHand.layer.shadowOpacity = 0.5;
self.computerHand.layer.shadowRadius = 8;
self.computerHand.layer.shadowOffset = CGSizeMake(12.0f, 12.0f);
self.computerHand.clipsToBounds = YES;
-
+
[self.playerHand.layer setCornerRadius:8.0];
self.playerHand.layer.shadowColor = [UIColor blackColor].CGColor;
self.playerHand.layer.shadowOpacity = 0.5;
self.playerHand.layer.shadowRadius = 8;
self.playerHand.layer.shadowOffset = CGSizeMake(12.0f, 12.0f);
self.playerHand.clipsToBounds = YES;
-
+
[self.facebookButton.layer setCornerRadius:8.0];
[self.facebookButton.layer setBorderWidth:4.0];
[self.facebookButton.layer setBorderColor:fontColor.CGColor];
self.facebookButton.clipsToBounds = YES;
-
+
[self updateScoreLabel];
[self resetField];
}
@@ -202,11 +205,11 @@ - (void)resetField {
self.computerHand.hidden =
self.playerHand.hidden =
self.againButton.hidden = YES;
-
+
self.rockButton.enabled =
self.paperButton.enabled =
self.scissorsButton.enabled = NO;
-
+
self.resultLabel.text = @"";
}
@@ -215,7 +218,7 @@ - (void)setFieldForPlayAgain {
self.rockButton.hidden =
self.paperButton.hidden =
self.scissorsButton.hidden = YES;
-
+
self.playerHand.hidden =
self.againButton.hidden = NO;
}
@@ -225,25 +228,25 @@ - (void)animateField {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
self.rockLabel.hidden = NO;
self.rockButton.hidden = NO;
-
+
// paper
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
self.paperLabel.hidden = NO;
self.paperButton.hidden = NO;
-
+
// scissors
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
self.scissorsLabel.hidden = NO;
self.scissorsButton.hidden = NO;
-
+
// shoot!
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
self.shootLabel.hidden =
self.computerHand.hidden = NO;
self.rockButton.enabled =
self.paperButton.enabled =
self.scissorsButton.enabled = YES;
-
+
self.computerHand.animationImages = @[ _rightImages[RPSCallRock], _rightImages[RPSCallPaper], _rightImages[RPSCallScissors]];
self.computerHand.animationDuration = .4;
self.computerHand.animationRepeatCount = 0;
@@ -274,7 +277,7 @@ - (void)callGame:(RPSCall)playerCall {
_lastPlayerCall = playerCall;
_lastComputerCall = [self callViaRandom];
self.computerHand.image = _rightImages[_lastComputerCall];
-
+
// update UI and counts based on result
RPSResult result = [self resultForPlayerCall:_lastPlayerCall
computerCall:_lastComputerCall];
@@ -483,7 +486,7 @@ - (void)publishResult {
[self publishPhotoForGesture:_lastPlayerCall];
return;
}
-
+
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
NSMutableDictionary<FBOpenGraphObject> *game = [self createGameObject];
@@ -497,7 +500,7 @@ - (void)publishResult {
}
batchEntryName:@"objectCreate"];
-
+
NSMutableDictionary<FBGraphObject> *action = [self createPlayActionWithGame:@"{result=objectCreate:$.id}"];
FBRequest *actionRequest = [FBRequest requestForPostWithGraphPath:@"me/fb_sample_rps:play"
graphObject:action];
View
4 samples/RPSSample/RPSSample/main.m
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
-
+ *