Permalink
Browse files

Facebook iOS SDK 3.11

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

Upgrading:
     https://developers.facebook.com/docs/ios/upgrading/

Reviewed By: jacl

Test Plan: Release Testing.
  • Loading branch information...
1 parent 1a98c58 commit 3c38d5db10ae412926fbecf532e0cd219d0412f3 @chrisp-fb chrisp-fb committed Dec 20, 2013
View
File renamed without changes.
@@ -24,6 +24,8 @@
#import "SCProtocols.h"
#import "TargetConditionals.h"
+#define DEFAULT_IMAGE_URL @"http://facebooksampleapp.com/scrumptious/static/images/logo.png"
+
@interface SCViewController() < UITableViewDataSource,
UIImagePickerControllerDelegate,
FBFriendPickerDelegate,
@@ -158,8 +160,10 @@ - (void)postOpenGraphAction {
// Create an Open Graph eat action with the meal, our location, and the people we were with.
id<SCOGEatMealAction> action = [self actionFromMealInfo];
+ id image = DEFAULT_IMAGE_URL;
if (self.selectedPhoto) {
- action.image = @[ @{ @"url" : @"{result=stagedphoto:$.uri}", @"user_generated" : @"true" } ];
+ image = @[@{@"url":@"{result=stagedphoto:$.uri}", @"user_generated":@"true"}];
+ action.image = image;
}
// create the Open Graph meal object for the meal we ate.
@@ -170,7 +174,7 @@ - (void)postOpenGraphAction {
// Facebook SDK * Object API *
id object = [FBGraphObject openGraphObjectForPostWithType:@"fb_sample_scrumps:meal"
title:self.selectedMeal
- image:@"https://fbcdn-photos-a.akamaihd.net/photos-ak-snc7/v85005/200/233936543368280/app_1_233936543368280_595563194.gif"
+ image:image
url:nil
description:[@"Delicious " stringByAppendingString:self.selectedMeal]];
FBRequest *createObject = [FBRequest requestForPostOpenGraphObject:object];
@@ -327,14 +331,14 @@ - (IBAction)announce:(id)sender {
}
- (void)presentShareDialogForMealInfo {
- id image = @"https://fbcdn-photos-a.akamaihd.net/photos-ak-snc7/v85005/200/233936543368280/app_1_233936543368280_595563194.gif";
+ id image = DEFAULT_IMAGE_URL;
// Create an Open Graph eat action with the meal, our location, and the people we were with.
id<SCOGEatMealAction> action = [self actionFromMealInfo];
if (self.selectedPhoto) {
self.selectedPhoto = [self normalizedImage:self.selectedPhoto];
- action.image = self.selectedPhoto;
image = @[@{@"url":self.selectedPhoto, @"user_generated":@"true"}];
+ action.image = image;
}
id object = [FBGraphObject openGraphObjectForPostWithType:@"fb_sample_scrumps:meal"
@@ -69,7 +69,7 @@ if [ -x "$APPLEDOC" ]; then
\cp -R $FB_SDK_FRAMEWORK_DOCS/docset/Contents $FB_SDK_BUILD_PACKAGE_DOCS \
|| die "Could not copy $$FB_SDK_FRAMEWORK_DOCS/docset/Contents"
fi
-\cp $FB_SDK_ROOT/README $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
+\cp $FB_SDK_ROOT/README.txt $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy README"
\cp $FB_SDK_ROOT/LICENSE $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy LICENSE"
@@ -45,7 +45,7 @@ rm -rf $DOCSET
hash $APPLEDOC &>/dev/null
if [ "$?" -eq "0" ]; then
- APPLEDOC_DOCSET_NAME="Facebook SDK 3.10 for iOS"
+ APPLEDOC_DOCSET_NAME="Facebook SDK 3.11 for iOS"
$APPLEDOC --project-name "$APPLEDOC_DOCSET_NAME" \
--project-company "Facebook" \
--company-id "com.facebook" \
@@ -12,9 +12,9 @@
<pkg-ref id="com.facebook.sdk.pkg"/>
</choice>
- <title>Facebook SDK 3.10 for iOS</title>
- <conclusion file="README" mime-type="text/plain" />
- <readme file="README" mime-type="text/plain" />
+ <title>Facebook SDK 3.11 for iOS</title>
+ <conclusion file="README.txt" mime-type="text/plain" />
+ <readme file="README.txt" mime-type="text/plain" />
<domains enable_currentUserHome="true" />
<volume-check>
<allowed-os-versions>
View
@@ -115,7 +115,8 @@
@"20130214",
@"20130410",
@"20130702",
- @"20131010"
+ @"20131010",
+ @"20131219",
};
static FBAppBridge *g_sharedInstance;
View
@@ -83,7 +83,10 @@ - (id)initWithID:(NSString *)ID enforceScheme:(BOOL)enforceScheme appID:(NSStrin
// internal factory for parsing app links from reengagement ads; i.e., version field = 2.
// in general, the parameters should consist of the original url followed by the various components to help construct the instance.
-+ (FBAppCall *)appCallFromApplinkArgs_v2:(NSURL *)originalURL applinkArgs:(NSDictionary *)applinkArgs createTimeUTC:(NSString *)createTimeUTC originalQueryParameters:(NSDictionary *)originalQueryParameters {
++ (FBAppCall *)appCallFromApplinkArgs_v2:(NSURL *)originalURL
+ applinkArgs:(NSDictionary *)applinkArgs
+ createTimeUTC:(NSString *)createTimeUTC
+ originalQueryParameters:(NSDictionary *)originalQueryParameters {
FBAppCall *appCall = [[[FBAppCall alloc] init:NO] autorelease];
NSMutableDictionary *methodArgs = [NSMutableDictionary dictionaryWithDictionary:applinkArgs[@"method_args"]];
@@ -92,20 +95,56 @@ + (FBAppCall *)appCallFromApplinkArgs_v2:(NSURL *)originalURL applinkArgs:(NSDic
}
NSURL *targetURL = [NSURL URLWithString:methodArgs[@"target_url"]];
- NSArray *refArray = [methodArgs[@"ref"] componentsSeparatedByString:@","];
- appCall.appLinkData = [[[FBAppLinkData alloc] initWithURL:originalURL targetURL:targetURL ref:refArray originalQueryParameters:originalQueryParameters arguments:methodArgs] autorelease];
+ appCall.appLinkData = [[[FBAppLinkData alloc] initWithURL:originalURL
+ targetURL:targetURL
+ originalParams:originalQueryParameters
+ arguments:methodArgs]
+ autorelease];
return appCall;
}
+// internal factory for parsing app links data
++ (FBAppCall *)appCallFromApplinkData:(NSURL *)originalURL
+ applinkData:(NSDictionary *)applinkData
+ originalQueryParameters:(NSDictionary *)originalQueryParameters {
+ FBAppCall *appCall = [[[FBAppCall alloc] init:NO] autorelease];
+
+ NSURL *targetURL = [NSURL URLWithString:applinkData[@"target_url"]];
+ NSString *ref = applinkData[@"ref"];
+ NSString *userAgent = applinkData[@"user_agent"];
+ NSDictionary *refererData = applinkData[@"referer_data"];
+ appCall.appLinkData = [[[FBAppLinkData alloc] initWithURL:originalURL
+ targetURL:targetURL
+ ref:ref
+ userAgent:userAgent
+ refererData:refererData
+ originalParams:originalQueryParameters]
+ autorelease];
+
+
+
+ return appCall;
+}
+
+
// Public factory method.
+ (FBAppCall *) appCallFromURL:(NSURL *)url {
NSDictionary *queryParams = [FBUtility queryParamsDictionaryFromFBURL:url];
+ NSString *applinkDataString = queryParams[@"al_applink_data"];
NSString *applinkArgsString = queryParams[@"fb_applink_args"];
- NSString *createTimeUTC = queryParams[@"fb_click_time_utc"];
-
- if (applinkArgsString) {
-
+ // applink data is preferred over applink args if both are present
+ if (applinkDataString) {
+ NSDictionary *applinkData = [FBUtility simpleJSONDecode:applinkDataString error:nil];
+ if (applinkData) {
+ return [FBAppCall appCallFromApplinkData:url
+ applinkData:applinkData
+ originalQueryParameters:queryParams];
+
+ }
+ } else if (applinkArgsString) {
+ NSString *createTimeUTC = queryParams[@"fb_click_time_utc"];
+
NSDictionary *applinkArgs = [FBUtility simpleJSONDecode:applinkArgsString error:nil];
int version = [applinkArgs[@"version"] intValue];
if (version){
@@ -116,7 +155,6 @@ + (FBAppCall *) appCallFromURL:(NSURL *)url {
}
}
}
-
// if we get here, we were unable to parse the URL.
return nil;
}
View
@@ -25,7 +25,7 @@
#import "FBSession+Internal.h"
#import "FBSessionAppEventsState.h"
#import "FBSessionManualTokenCachingStrategy.h"
-#import "FBSettings.h"
+#import "FBSettings+Internal.h"
#import "FBUtility.h"
//
@@ -135,7 +135,6 @@ @interface FBAppEvents ()
@property (readwrite, atomic) FBAppEventsFlushBehavior flushBehavior;
@property (readwrite, atomic) BOOL haveOutstandingPersistedData;
@property (readwrite, atomic, retain) FBSession *lastSessionLoggedTo;
-@property (readwrite, atomic, retain) FBSession *anonymousSession;
@property (readwrite, atomic, retain) NSTimer *flushTimer;
@property (readwrite, atomic, retain) NSTimer *attributionIDRecheckTimer;
@property (readwrite, atomic) AppSupportsAttributionStatus appSupportsAttributionStatus;
@@ -146,6 +145,7 @@ @interface FBAppEvents ()
// Dictionary from appIDs to ClientToken-based app-authenticated session for that appID.
@property (readwrite, atomic, retain) NSMutableDictionary *appAuthSessions;
+@property (readwrite, atomic, retain) NSMutableDictionary *anonymousSessions;
@end
@@ -165,22 +165,6 @@ @implementation FBAppEvents
const int APP_SUPPORTS_ATTRIBUTION_ID_RECHECK_PERIOD = 60 * 60 * 24;
const int MAX_IDENTIFIER_LENGTH = 40;
-
-
-@synthesize
- flushBehavior = _flushBehavior,
- haveOutstandingPersistedData = _haveOutstandingPersistedData,
- lastSessionLoggedTo = _lastSessionLoggedTo,
- anonymousSession = _anonymousSession,
- appAuthSessions = _appAuthSessions,
- flushTimer = _flushTimer,
- attributionIDRecheckTimer = _attributionIDRecheckTimer,
- appSupportsAttributionStatus = _appSupportsAttributionStatus,
- appSupportsImplicitLogging = _appSupportsImplicitLogging,
- haveFetchedAppSettings = _haveFetchedAppSettings,
- eventNameRegex = _eventNameRegex,
- validatedIdentifiers = _validatedIdentifiers;
-
#pragma mark - logEvent variants
/*
@@ -399,6 +383,7 @@ - (FBAppEvents *)init {
self.appSupportsAttributionStatus = AppSupportsAttributionUnknown;
self.appAuthSessions = [[[NSMutableDictionary alloc] init] autorelease];
+ _anonymousSessions = [[NSMutableDictionary alloc] init];
// Timer fires unconditionally on a regular interval... handler decides whether to call flush.
self.flushTimer = [NSTimer scheduledTimerWithTimeInterval:FLUSH_PERIOD_IN_SECONDS
@@ -765,7 +750,13 @@ - (BOOL)doesSessionHaveUserToken:(FBSession *)session {
// Assume that if we're not using an appAuthSession (built from the Client Token) or the anonymous session,
// then we have a logged in user token.
FBSession *appAuthSession = [self.appAuthSessions objectForKey:session.appID];
- return session != appAuthSession && session != self.anonymousSession;
+ if (session == appAuthSession) {
+ return NO;
+ }
+ NSSet *matchingAnonymousSessions = [self.anonymousSessions keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *stop) {
+ return (obj == session);
+ }];
+ return matchingAnonymousSessions.count == 0;
}
@@ -810,21 +801,23 @@ - (FBSession *)sessionToSendRequestTo:(FBSession *)session {
}
session = appAuthSession;
- } else {
-
+ } else if (appID) {
+ // Note appID cannot be nil at this point but we have a conditional to satisfy clang.
+ FBSession *anonymousSession = self.anonymousSessions[appID];
// No clientToken, create session without access token that can be used for logging the events in 'eventsNotRequiringToken', preferring
// appID coming in with the incoming session (or the activeSession), even if they don't have an access token.
- if (!self.anonymousSession) {
+ if (!anonymousSession) {
@synchronized(self) {
- if (!self.anonymousSession) { // in case it snuck in
- self.anonymousSession = [FBAppEvents unaffinitizedSessionFromToken:[FBSessionTokenCachingStrategy nullCacheInstance]
+ if (!anonymousSession) { // in case it snuck in
+ anonymousSession = [FBAppEvents unaffinitizedSessionFromToken:[FBSessionTokenCachingStrategy nullCacheInstance]
appID:appID];
+ self.anonymousSessions[appID] = anonymousSession;
}
}
}
- session = self.anonymousSession;
+ session = anonymousSession;
}
}
@@ -1130,7 +1123,8 @@ - (FBRequest *)instanceCustomAudienceThirdPartyIDRequest:(FBSession *)session {
// 3) if we have a user session token, then no need to send attribution ID / advertiser ID back as the udid parameter
// 4) otherwise, send back the udid parameter.
- if ([FBUtility advertisingTrackingStatus] == AdvertisingTrackingDisallowed || [FBSettings limitEventAndDataUsage]) {
+ if ([FBUtility advertisingTrackingStatus] == AdvertisingTrackingDisallowed || [FBSettings limitEventAndDataUsage]
+ || [FBSettings restrictedTreatment] == FBRestrictedTreatmentYES) {
return nil;
}
@@ -20,7 +20,17 @@
@property (readonly) BOOL isValid;
-- (id)initWithURL:(NSURL*)url targetURL:(NSURL *)targetURL ref:(NSArray *)ref originalQueryParameters:(NSDictionary *)originalQueryParameters arguments:(NSDictionary *)arguments;
+- (id)initWithURL:(NSURL*)url
+ targetURL:(NSURL *)targetURL
+ originalParams:(NSDictionary *)originalQueryParameters
+ arguments:(NSDictionary *)arguments;
+
+- (id) initWithURL:(NSURL*)url
+ targetURL:(NSURL *)targetURL
+ ref:(NSString *)ref
+ userAgent:(NSString *)userAgent
+ refererData:(NSDictionary *)refererData
+ originalParams:(NSDictionary *)originalQueryParameters;
+ (FBAppLinkData *)createFromURL:(NSURL *)url;
View
@@ -31,7 +31,13 @@
@property (readonly) NSArray *actionIDs;
/*! @abstract Reference breadcrumb provided during creation of story */
-@property (readonly) NSArray *ref;
+@property (readonly) NSString *ref;
+
+/*! @abstract User Agent string set by the referer */
+@property (readonly) NSString *userAgent;
+
+/*! @abstract Referer data is a JSON object set by the referer with referer-specific content */
+@property (readonly) NSDictionary *refererData;
/*! @abstract Full set of query parameters for this app link */
@property (readonly) NSDictionary *originalQueryParameters;
View
@@ -23,38 +23,62 @@ @interface FBAppLinkData ()
@property (readwrite, retain) NSURL *targetURL;
@property (readwrite, copy) NSArray *actionTypes;
@property (readwrite, copy) NSArray *actionIDs;
-@property (readwrite, copy) NSArray *ref;
+@property (readwrite, copy) NSString *ref;
@property (readwrite, copy) NSDictionary *originalQueryParameters;
@property (readwrite, retain) NSURL *originalURL;
@property (readwrite, copy) NSDictionary *arguments;
+@property (readwrite, copy) NSString *userAgent;
+@property (readwrite, copy) NSDictionary *refererData;
@end
@implementation FBAppLinkData
- (id)initWithURL:(NSURL*)url {
NSDictionary *params = [FBUtility queryParamsDictionaryFromFBURL:url];
NSURL *targetURL = (params[@"target_url"]) ? [[[NSURL alloc] initWithString:params[@"target_url"]] autorelease] : nil;
- NSArray *ref = [params[@"fb_ref"] componentsSeparatedByString:@","];
NSDictionary *originalQueryParameters = params;
- if (self = [self initWithURL:url targetURL:targetURL ref:ref originalQueryParameters:originalQueryParameters arguments:nil]) {
+ if (self = [self initWithURL:url targetURL:targetURL originalParams:originalQueryParameters arguments:nil]) {
self.actionIDs = [params[@"fb_action_ids"] componentsSeparatedByString:@","];
self.actionTypes = [params[@"fb_action_types"] componentsSeparatedByString:@","];
}
return self;
}
-- (id) initWithURL:(NSURL*)url targetURL:(NSURL *)targetURL ref:(NSArray *)ref originalQueryParameters:(NSDictionary *)originalQueryParameters arguments:(NSDictionary *)arguments {
+- (id) initWithURL:(NSURL*)url
+ targetURL:(NSURL *)targetURL
+ originalParams:(NSDictionary *)originalQueryParameters
+ arguments:(NSDictionary *)arguments {
if (self = [super init]) {
self.originalURL = url;
self.targetURL = targetURL;
- self.ref = ref;
+ self.ref = nil;
+ self.userAgent = nil;
+ self.refererData = nil;
self.originalQueryParameters = originalQueryParameters;
self.arguments = arguments;
}
return self;
}
+- (id) initWithURL:(NSURL*)url
+ targetURL:(NSURL *)targetURL
+ ref:(NSString *)ref
+ userAgent:(NSString *)userAgent
+ refererData:(NSDictionary *)refererData
+ originalParams:(NSDictionary *)originalQueryParameters {
+ if (self = [super init]) {
+ self.originalURL = url;
+ self.targetURL = targetURL;
+ self.ref = ref;
+ self.userAgent = userAgent;
+ self.refererData = refererData;
+ self.originalQueryParameters = originalQueryParameters;
+ self.arguments = nil;
+ }
+ return self;
+}
+
- (void)dealloc
{
[_targetURL release];
Oops, something went wrong.

1 comment on commit 3c38d5d

This release still contains the warnings and bugs from the following pull request: #563

Please sign in to comment.