Permalink
Browse files

Facebook iOS SDK 3.10

  • Loading branch information...
1 parent 5795d48 commit 1a98c586b43dc4e27026392282a693756f4c627b @chrisp-fb chrisp-fb committed Nov 20, 2013
Showing with 271 additions and 123 deletions.
  1. +2 −2 samples/Scrumptious/Scrumptious.xcodeproj/project.pbxproj
  2. +1 −2 samples/Scrumptious/scrumptious/SCAppDelegate.m
  3. +5 −5 samples/Scrumptious/scrumptious/SCLoginViewController.m
  4. +9 −8 samples/Scrumptious/scrumptious/SCViewController.m
  5. +1 −1 scripts/build_distribution.sh
  6. +1 −1 scripts/build_documentation.sh
  7. +1 −1 scripts/productbuild_distribution.xml
  8. +2 −1 src/FBAppBridge.m
  9. +18 −5 src/FBAppEvents.m
  10. +11 −11 src/FBDialogs.h
  11. +6 −1 src/FBFriendPickerViewController.h
  12. +14 −1 src/FBFriendPickerViewController.m
  13. +2 −0 src/FBGraphObjectTableCell.m
  14. +1 −1 src/FBGraphObjectTableSelection.h
  15. +28 −6 src/FBGraphObjectTableSelection.m
  16. +1 −1 src/FBLoginDialog.h
  17. +4 −2 src/FBLoginDialog.m
  18. +1 −1 src/FBLoginDialogParams.m
  19. +9 −0 src/FBLoginView.h
  20. +17 −9 src/FBLoginView.m
  21. +4 −3 src/FBOpenGraphActionShareDialogParams.m
  22. +1 −1 src/FBSDKVersion.h
  23. +8 −0 src/FBSession+Internal.h
  24. +70 −22 src/FBSession.m
  25. +2 −0 src/FBSessionAppEventsState.h
  26. +4 −3 src/FBSessionAppEventsState.m
  27. +6 −6 src/FBSettings.h
  28. +3 −2 src/FBShareDialogParams.m
  29. +4 −4 src/Facebook.m
  30. +1 −1 src/FacebookSDK.h
  31. +21 −15 src/facebook-ios-sdk.xcodeproj/project.pbxproj
  32. +1 −1 src/facebook-ios-sdk.xcodeproj/xcshareddata/xcschemes/FacebookSDKIntegrationTests.xcscheme
  33. +1 −1 src/facebook-ios-sdk.xcodeproj/xcshareddata/xcschemes/facebook-ios-sdk-tests.xcscheme
  34. +1 −1 src/facebook-ios-sdk.xcodeproj/xcshareddata/xcschemes/facebook-ios-sdk.xcscheme
  35. +10 −4 src/tests/FBSessionTests.m
@@ -371,7 +371,7 @@
INFOPLIST_FILE = "Scrumptious/Scrumptious-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "$(inherited)";
- OTHER_LDFLAGS = "-ObjC";
+ OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
@@ -392,7 +392,7 @@
INFOPLIST_FILE = "Scrumptious/Scrumptious-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "$(inherited)";
- OTHER_LDFLAGS = "-ObjC";
+ OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
@@ -63,10 +63,9 @@ - (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (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.
// http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
- // [FBProfilePictureView class];
+ [FBLoginView class];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self resetMainViewController];
@@ -95,18 +95,18 @@ - (void)loginView:(FBLoginView *)loginView
// as a token becoming invalid). Please see the [- postOpenGraphAction:]
// and [- requestPermissionAndPost] on `SCViewController` for further
// error handling on other operations.
-
- if (error.fberrorShouldNotifyUser) {
+ FBErrorCategory errorCategory = [FBErrorUtility errorCategoryForError:error];
+ if ([FBErrorUtility shouldNotifyUserForError:error]) {
// If the SDK has a message for the user, surface it. This conveniently
// handles cases like password change or iOS6 app slider state.
alertTitle = @"Something Went Wrong";
- alertMessage = error.fberrorUserMessage;
- } else if (error.fberrorCategory == FBErrorCategoryAuthenticationReopenSession) {
+ alertMessage = [FBErrorUtility userMessageForError:error];
+ } else if (errorCategory == FBErrorCategoryAuthenticationReopenSession) {
// It is important to handle session closures as mentioned. You can inspect
// the error for more context but this sample generically notifies the user.
alertTitle = @"Session Error";
alertMessage = @"Your current session is no longer valid. Please log in again.";
- } else if (error.fberrorCategory == FBErrorCategoryUserCancelled) {
+ } else if (errorCategory == FBErrorCategoryUserCancelled) {
// The user has cancelled a login. You can inspect the error
// for more context. For this sample, we will simply ignore it.
NSLog(@"user cancelled login");
@@ -197,7 +197,7 @@ - (void)postOpenGraphAction {
NSError *error) {
[self enableUserInteraction:YES];
- if (!error) {
+ if (result) {
[[[UIAlertView alloc] initWithTitle:@"Result"
message:[NSString stringWithFormat:@"Posted Open Graph action, id: %@",
[result objectForKey:@"id"]]
@@ -208,7 +208,7 @@ - (void)postOpenGraphAction {
// start over
[self resetMealInfo];
- } else {
+ } else if (error) {
[self handlePostOpenGraphActionError:error];
}
}];
@@ -231,7 +231,8 @@ - (void)handlePostOpenGraphActionError:(NSError *) error{
// retry policy of one additional attempt. Please refer to
// https://developers.facebook.com/docs/reference/api/errors/ for more information.
_retryCount++;
- if (error.fberrorCategory == FBErrorCategoryThrottling) {
+ FBErrorCategory errorCategory = [FBErrorUtility errorCategoryForError:error];
+ if (errorCategory == FBErrorCategoryThrottling) {
// We also retry on a throttling error message. A more sophisticated app
// should consider a back-off period.
if (_retryCount < 2) {
@@ -248,7 +249,7 @@ - (void)handlePostOpenGraphActionError:(NSError *) error{
// can be worthwhile to request for permissions again at the point
// that they are needed. This sample assumes a simple policy
// of re-requesting permissions.
- if (error.fberrorCategory == FBErrorCategoryPermissions) {
+ if (errorCategory == FBErrorCategoryPermissions) {
NSLog(@"Re-requesting permissions");
[self requestPermissionAndPost];
return;
@@ -268,7 +269,7 @@ - (void)requestPermissionAndPost {
} else if (error){
// Facebook SDK * error handling *
// if the operation is not user cancelled
- if (error.fberrorCategory != FBErrorCategoryUserCancelled) {
+ if ([FBErrorUtility errorCategoryForError:error] != FBErrorCategoryUserCancelled) {
[self presentAlertForError:error];
}
}
@@ -278,12 +279,12 @@ - (void)requestPermissionAndPost {
- (void) presentAlertForError:(NSError *)error {
// Facebook SDK * error handling *
// Error handling is an important part of providing a good user experience.
- // When fberrorShouldNotifyUser is YES, a fberrorUserMessage can be
+ // When shouldNotifyUser is YES, a userMessage can be
// presented as a user-ready message
- if (error.fberrorShouldNotifyUser) {
+ if ([FBErrorUtility shouldNotifyUserForError:error]) {
// The SDK has a message for the user, surface it.
[[[UIAlertView alloc] initWithTitle:@"Something Went Wrong"
- message:error.fberrorUserMessage
+ message:[FBErrorUtility userMessageForError:error]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
@@ -43,7 +43,7 @@ CODE_SIGN_IDENTITY='Developer ID Installer: Facebook, Inc. (V9WTTPBFK9)'
# Call out to build prerequisites.
#
if is_outermost_build; then
- . $FB_SDK_SCRIPT/build_framework.sh -t -c Release
+ . $FB_SDK_SCRIPT/build_framework.sh -c Release
if [ -x "$APPLEDOC" ]; then
. $FB_SDK_SCRIPT/build_documentation.sh
fi
@@ -45,7 +45,7 @@ rm -rf $DOCSET
hash $APPLEDOC &>/dev/null
if [ "$?" -eq "0" ]; then
- APPLEDOC_DOCSET_NAME="Facebook SDK 3.9 for iOS"
+ APPLEDOC_DOCSET_NAME="Facebook SDK 3.10 for iOS"
$APPLEDOC --project-name "$APPLEDOC_DOCSET_NAME" \
--project-company "Facebook" \
--company-id "com.facebook" \
@@ -12,7 +12,7 @@
<pkg-ref id="com.facebook.sdk.pkg"/>
</choice>
- <title>Facebook SDK 3.9 for iOS</title>
+ <title>Facebook SDK 3.10 for iOS</title>
<conclusion file="README" mime-type="text/plain" />
<readme file="README" mime-type="text/plain" />
<domains enable_currentUserHome="true" />
View
@@ -114,7 +114,8 @@
static NSString *const FBAppBridgeVersions[] = {
@"20130214",
@"20130410",
- @"20130702"
+ @"20130702",
+ @"20131010"
};
static FBAppBridge *g_sharedInstance;
View
@@ -878,8 +878,15 @@ - (void)handleActivitiesPostCompletion:(NSError *)error
}
FBSessionAppEventsState *appEventsState = session.appEventsState;
+ BOOL allEventsAreImplicit = YES;
@synchronized (appEventsState) {
if (flushResult != FlushResultNoConnectivity) {
+ for (NSDictionary *eventAndImplicitFlag in appEventsState.inFlightEvents) {
+ if (![eventAndImplicitFlag[kFBAppEventIsImplicit] boolValue]) {
+ allEventsAreImplicit = NO;
+ break;
+ }
+ }
// Either success or a real server error. Either way, no more in flight events.
[appEventsState clearInFlightAndStats];
@@ -889,7 +896,7 @@ - (void)handleActivitiesPostCompletion:(NSError *)error
}
if (flushResult == FlushResultServerError) {
- [FBAppEvents logAndNotify:[error description]];
+ [FBAppEvents logAndNotify:[error description] allowLogAsDeveloperError:!allEventsAreImplicit];
}
NSString *resultString = @"<unknown>";
@@ -1005,7 +1012,7 @@ - (void)persistDataIfNotInFlight {
[FBAppEvents persistAppEventsData:appEventsState];
}
-+ (void)logAndNotify:(NSString *)msg {
++ (void)logAndNotify:(NSString *)msg allowLogAsDeveloperError:(BOOL *)allowLogAsDeveloperError {
// capture reason and nested code as user info
NSDictionary* userinfo = [NSDictionary dictionaryWithObject:msg forKey:FBErrorAppEventsReasonKey];
@@ -1016,9 +1023,11 @@ + (void)logAndNotify:(NSString *)msg {
userInfo:userinfo];
NSString *behaviorToLog = FBLoggingBehaviorAppEvents;
- if ([[FBSettings loggingBehavior] containsObject:FBLoggingBehaviorDeveloperErrors]) {
- // Rather than log twice, prefer 'DeveloperErrors' if it's set over AppEvents.
- behaviorToLog = FBLoggingBehaviorDeveloperErrors;
+ if (allowLogAsDeveloperError) {
+ if ([[FBSettings loggingBehavior] containsObject:FBLoggingBehaviorDeveloperErrors]) {
+ // Rather than log twice, prefer 'DeveloperErrors' if it's set over AppEvents.
+ behaviorToLog = FBLoggingBehaviorDeveloperErrors;
+ }
}
[FBLogger singleShotLogEntry:behaviorToLog logEntry:msg];
@@ -1027,6 +1036,10 @@ + (void)logAndNotify:(NSString *)msg {
object:err];
}
++ (void)logAndNotify:(NSString *)msg {
+ [FBAppEvents logAndNotify:msg allowLogAsDeveloperError:YES];
+}
+
#pragma mark - event log persistence
+ (void)persistAppEventsData:(FBSessionAppEventsState *)appEventsState {
View
@@ -201,7 +201,7 @@ NSError *error);
/*!
@abstract
- Determines whether a call to presentFBShareDialogWithTarget: will successfully
+ Determines whether a call to presentShareDialogWithTarget: will successfully
present a dialog in the Facebook application. This is useful for applications that
need to modify the available UI controls depending on whether the dialog is
available on the current platform.
@@ -211,7 +211,7 @@ NSError *error);
@return YES if the dialog would be presented, and NO if not
@discussion A return value of YES here indicates that the corresponding
- presentFBShareDialogWithParams method will return a non-nil FBAppCall for the same
+ presentShareDialogWithParams method will return a non-nil FBAppCall for the same
params. And vice versa.
*/
+ (BOOL)canPresentShareDialogWithParams:(FBShareDialogParams *)params;
@@ -244,7 +244,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresetFBShareDialogWithParams method is also returning YES for the same params.
+ canPresentShareDialogWithParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithParams:(FBShareDialogParams *)params
clientState:(NSDictionary *)clientState
@@ -274,7 +274,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresetFBShareDialogWithParams method is also returning YES for the same params.
+ canPresentShareDialogWithParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
handler:(FBDialogAppCallCompletionHandler)handler;
@@ -305,7 +305,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresetFBShareDialogWithParams method is also returning YES for the same params.
+ canPresentShareDialogWithParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
name:(NSString *)name
@@ -347,7 +347,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresetFBShareDialogWithParams method is also returning YES for the same params.
+ canPresentShareDialogWithParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
name:(NSString *)name
@@ -359,7 +359,7 @@ NSError *error);
/*!
@abstract
- Determines whether a call to presentFBShareDialogWithOpenGraphActionParams:clientState:handler:
+ Determines whether a call to presentShareDialogWithOpenGraphActionParams:clientState:handler:
will successfully present a dialog in the Facebook application. This is useful for applications
that need to modify the available UI controls depending on whether the dialog is
available on the current platform.
@@ -369,7 +369,7 @@ NSError *error);
@return YES if the dialog would be presented, and NO if not
@discussion A return value of YES here indicates that the corresponding
- presentFBShareDialogWithOpenGraphActionParams method will return a non-nil FBAppCall for
+ presentShareDialogWithOpenGraphActionParams method will return a non-nil FBAppCall for
the same params. And vice versa.
*/
+ (BOOL)canPresentShareDialogWithOpenGraphActionParams:(FBOpenGraphActionShareDialogParams *)params;
@@ -402,7 +402,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentFBShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
+ canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithOpenGraphActionParams:(FBOpenGraphActionShareDialogParams *)params
clientState:(NSDictionary *)clientState
@@ -439,7 +439,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentFBShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
+ canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
actionType:(NSString *)actionType
@@ -481,7 +481,7 @@ NSError *error);
FBAppCallCompletionHandler.
@discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentFBShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
+ canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
*/
+ (FBAppCall *)presentShareDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
actionType:(NSString *)actionType
@@ -125,8 +125,13 @@ typedef enum {
@abstract
The list of friends that are currently selected in the veiw.
The items in the array are <FBGraphUser> objects.
+
+ @discussion
+ You can set this this array to pre-select items in the picker. The objects in the array
+ must be complete id<FBGraphUser> objects (i.e., fetched from a Graph query or from a
+ previous picker's selection, with id and appropriate name fields).
*/
-@property (nonatomic, retain, readonly) NSArray *selection;
+@property (nonatomic, copy) NSArray *selection;
/*!
@abstract
@@ -178,7 +178,20 @@ - (void)setItemPicturesEnabled:(BOOL)itemPicturesEnabled {
}
- (NSArray *)selection {
- return self.selectionManager.selection;
+ // There might be bogus items set via setSelection, so we need to check against
+ // datasource and filter them out.
+ NSMutableArray* validSelection = [[[NSMutableArray alloc] init] autorelease];
+ for (FBGraphObject *item in self.selectionManager.selection) {
+ NSIndexPath* indexPath = [self.dataSource indexPathForItem:item];
+ if (indexPath != nil) {
+ [validSelection addObject:item];
+ }
+ }
+ return validSelection;
+}
+
+- (void)setSelection:(NSArray *)selection {
+ [self.selectionManager selectItem:selection tableView:self.tableView];
}
// We don't really need to store session, let the loader hold it.
@@ -87,6 +87,7 @@ - (void)dealloc
#pragma mark -
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- (void)layoutSubviews
{
[super layoutSubviews];
@@ -122,6 +123,7 @@ - (void)layoutSubviews
[self.detailTextLabel setHidden:!(hasSubtitle)];
[self.titleSuffixLabel setHidden:!(hasTitleSuffix)];
}
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
+ (CGFloat)rowHeight
{
@@ -28,7 +28,7 @@
- (id)initWithDataSource:(FBGraphObjectTableDataSource *)dataSource;
- (void)clearSelectionInTableView:(UITableView*)tableView;
-
+- (void)selectItem: (NSArray *)items tableView:(UITableView *)tableView;
@end
Oops, something went wrong.

0 comments on commit 1a98c58

Please sign in to comment.