Skip to content

Commit

Permalink
Facebook iOS SDK 3.15
Browse files Browse the repository at this point in the history
  • Loading branch information
toddkrabach committed Jun 13, 2014
1 parent ad6d8b1 commit 3096a04
Show file tree
Hide file tree
Showing 295 changed files with 3,195 additions and 2,274 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ test/UnitTest/build/
.DS_Store
project.xcworkspace
xcuserdata
xcshareddata
.arc
.arcconfig
.internal/
Expand Down
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
url = git://github.com/tomaz/appledoc.git
[submodule "Bolts-IOS"]
path = Bolts-IOS
url = git://github.com/BoltsFramework/Bolts-iOS.git
url = git://github.com/BoltsFramework/Bolts-iOS.git
[submodule "vendor/ios-snapshot-test-case"]
path = vendor/ios-snapshot-test-case
url = git://github.com/facebook/ios-snapshot-test-case.git
[submodule "vendor/xctool"]
path = vendor/xctool
url = git://github.com/facebook/xctool.git
92 changes: 49 additions & 43 deletions samples/HelloFacebookSample/HelloFacebookSample/HFViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,45 +195,47 @@ - (IBAction)postStatusUpdateClick:(UIButton *)sender {
caption:nil
description:@"The 'Hello Facebook' sample application showcases simple Facebook integration."
picture:nil];
FBAppCall *appCall = [FBDialogs presentShareDialogWithParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success!");
}
}];

if (!appCall) {

BOOL isSuccessful = NO;
if ([FBDialogs canPresentShareDialogWithParams:params]) {
FBAppCall *appCall = [FBDialogs presentShareDialogWithParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success!");
}
}];
isSuccessful = (appCall != nil);
}
if (!isSuccessful && [FBDialogs canPresentOSIntegratedShareDialogWithSession:[FBSession activeSession]]){
// 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 *innerConnection, id result, NSError *error) {
[self showAlert:message result:result error:error];
self.buttonPostStatus.enabled = YES;
}];
[connection start];

self.buttonPostStatus.enabled = NO;
}];
}
isSuccessful = [FBDialogs presentOSIntegratedShareDialogModallyFrom:self
initialText:nil
image:nil
url:urlToShare
handler:nil];
}
if (!isSuccessful) {
[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 *innerConnection, id result, NSError *error) {
[self showAlert:message result:result error:error];
self.buttonPostStatus.enabled = YES;
}];
[connection start];

self.buttonPostStatus.enabled = NO;
}];
}
}

Expand All @@ -248,16 +250,20 @@ - (IBAction)postPhotoClick:(UIButton *)sender {
FBPhotoParams *params = [[FBPhotoParams alloc] init];
params.photos = @[img];

FBAppCall *appCall = [FBDialogs presentShareDialogWithPhotoParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
BOOL isSuccessful = NO;
if (canPresent) {
FBAppCall *appCall = [FBDialogs presentShareDialogWithPhotoParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success!");
}
}];
if (!appCall) {
isSuccessful = (appCall != nil);
}
if (!isSuccessful) {
[self performPublishAction:^{
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
connection.errorBehavior = FBRequestConnectionErrorBehaviorReconnectSession
Expand Down
15 changes: 15 additions & 0 deletions samples/Scrumptious/scrumptious/SCMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ @interface SCMainViewController () <CLLocationManagerDelegate, FBFriendPickerDel
@property (nonatomic, strong) SCShareUtility *shareUtility;
@end

static int const MIN_USER_GENERATED_PHOTO_DIMENSION = 480;

@implementation SCMainViewController
{
FBCacheDescriptor *_friendsCacheDescriptor;
Expand Down Expand Up @@ -221,6 +223,19 @@ - (IBAction)pickMeal:(id)sender

- (IBAction)share:(id)sender
{
//the SDK expects user generated images to be at least 480px in height and width.
//photos with the user generated flag set to false can be smaller but this sample app assumes the photo to be user generated
if (self.selectedPhoto && ([self.selectedPhoto size].height < MIN_USER_GENERATED_PHOTO_DIMENSION || [self.selectedPhoto size].width < MIN_USER_GENERATED_PHOTO_DIMENSION)) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:[NSString stringWithFormat:@"%@%d%@", @"This photo is too small. Choose a photo with dimensions larger than ", MIN_USER_GENERATED_PHOTO_DIMENSION, @"px."]
message:nil
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}

SCShareUtility *shareUtility = [[SCShareUtility alloc] initWithMealTitle:self.selectedMeal
place:self.selectedPlace
friends:self.selectedFriends
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

# This script builds the FacebookSDK.framework, FBAudienceNetwork.framework, all samples, and the distribution package.
# This script builds the FacebookSDK.framework, all samples, and the distribution package.

. "${FB_SDK_SCRIPT:-$(dirname "$0")}/common.sh"

Expand Down
6 changes: 6 additions & 0 deletions scripts/build_distribution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "project.pbxproj" -pri
${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \
done

# -----------------------------------------------------------------------------
# Build FBAudienceNetwork framework
#
test -f $FB_ADS_FRAMEWORK_SCRIPT/build_distribution.sh \
&& $FB_ADS_FRAMEWORK_SCRIPT/build_distribution.sh

# -----------------------------------------------------------------------------
# Build .pkg from package directory
#
Expand Down
15 changes: 15 additions & 0 deletions scripts/build_documentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ fi

APPLEDOC_PATH="$FB_SDK_BUILD"/appledoc
progress_message "$APPLEDOC_PATH"

if [ ! -f "$APPLEDOC_PATH" ]; then
# appledoc is currently being refactored for v3, which will be free from GC.
# In the meantime, use a pre-compiled binary if it is dropped into
# vendor/appledoc_bin/
VENDOR_APPLEDOC_PATH="$FB_SDK_ROOT"/vendor/appledoc_bin/appledoc
if [ -f "$VENDOR_APPLEDOC_PATH" ]; then
cp "$VENDOR_APPLEDOC_PATH" "$APPLEDOC_PATH"
fi
fi

if [ ! -f "$APPLEDOC_PATH" ]; then
progress_message Building appledoc
pushd "$FB_SDK_ROOT"/vendor/appledoc/ >/dev/null
Expand All @@ -48,12 +59,16 @@ cd "$FB_SDK_SRC"

rm -rf "$FB_SDK_FRAMEWORK_DOCS"

DOCSET="$FB_SDK_BUILD"/docset.build
rm -rf "$DOCSET"

hash "$APPLEDOC_PATH" &>/dev/null
if [ "$?" -eq "0" ]; then
APPLEDOC_DOCSET_NAME="Facebook SDK $FB_SDK_VERSION_SHORT for iOS"
"$APPLEDOC_PATH" --project-name "$APPLEDOC_DOCSET_NAME" \
--project-company "Facebook" \
--company-id "com.facebook" \
--output "$DOCSET" \
--preprocess-headerdoc \
--docset-bundle-filename "$FB_SDK_DOCSET_NAME" \
--docset-feed-name "$APPLEDOC_DOCSET_NAME" \
Expand Down
24 changes: 13 additions & 11 deletions scripts/build_framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ do
esac
done

test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'
test -x "$LIPO" || die 'Could not find lipo in $PATH'

FB_SDK_UNIVERSAL_BINARY=$FB_SDK_BUILD/${BUILDCONFIGURATION}-universal/$FB_SDK_BINARY_NAME
Expand All @@ -79,21 +78,24 @@ test -d "$FB_SDK_BUILD" \

cd "$FB_SDK_SRC"
function xcode_build_target() {
echo "Compiling for platform: ${1}."
"$XCODEBUILD" \
RUN_CLANG_STATIC_ANALYZER=NO \
-target "facebook-ios-sdk" \
echo "Compiling for platform: ${1} (${2}, ${3})."
"$XCTOOL" \
-project facebook-ios-sdk.xcodeproj \
-scheme facebook-ios-sdk \
-sdk $1 \
-configuration "${2}" \
VALID_ARCHS="${3}" \
ONLY_ACTIVE_ARCH=NO \
RUN_CLANG_STATIC_ANALYZER=NO \
SYMROOT="$FB_SDK_BUILD" \
clean build \
|| die "XCode build failed for platform: ${1} (${2})."
|| die "XCode build failed for platform: ${1} (${2}, ${3})."
}

xcode_build_target "iphonesimulator" "${BUILDCONFIGURATION}"
xcode_build_target "iphoneos" "${BUILDCONFIGURATION}"
xcode_build_target "iphonesimulator" "${BUILDCONFIGURATION}64"
xcode_build_target "iphoneos" "${BUILDCONFIGURATION}64"
xcode_build_target iphonesimulator "${BUILDCONFIGURATION}" i386
xcode_build_target iphoneos "${BUILDCONFIGURATION}" "armv7 armv7s"
xcode_build_target iphonesimulator "${BUILDCONFIGURATION}64" x86_64
xcode_build_target iphoneos "${BUILDCONFIGURATION}64" arm64

# -----------------------------------------------------------------------------
# Merge lib files for different platforms into universal binary
Expand Down Expand Up @@ -180,7 +182,7 @@ if [ ${NOEXTRAS:-0} -eq 1 ];then
else
progress_message "Running unit tests."
cd "$FB_SDK_SRC"
"$FB_SDK_SCRIPT/run_tests.sh" -c $BUILDCONFIGURATION facebook-ios-sdk-tests
"$FB_SDK_SCRIPT/run_tests.sh" -c $BUILDCONFIGURATION facebook-ios-sdk-tests FacebookSDKApplicationTests
fi

# -----------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ if [ -z "$FB_SDK_SCRIPT" ]; then
# The path to the framework docs
FB_SDK_FRAMEWORK_DOCS=$FB_SDK_BUILD/$FB_SDK_DOCSET_NAME

# The path to AudienceNetwork scripts directory
FB_ADS_FRAMEWORK_SCRIPT=$FB_SDK_ROOT/ads/scripts

# The path to the Bolts framework and its scripts directory
BOLTS_ROOT=$FB_SDK_ROOT/Bolts-IOS
BOLTS_SCRIPT=$BOLTS_ROOT/scripts
Expand Down Expand Up @@ -126,7 +129,7 @@ if [ -z $FB_SDK_ENV ]; then
}

test -n "$XCODESELECT" || XCODESELECT=$(which xcode-select)
test -n "$XCODEBUILD" || XCODEBUILD=$(which xcodebuild)
test -n "$XCTOOL" || XCTOOL=$FB_SDK_ROOT/vendor/xctool/xctool.sh
test -n "$LIPO" || LIPO=$(which lipo)
test -n "$PACKAGEBUILD" || PACKAGEBUILD=$(which pkgbuild)
test -n "$PRODUCTBUILD" || PRODUCTBUILD=$(which productbuild)
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure_simulator_for_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function write_xcconfig {
echo "Wrote test app configuration to: $1"
}

XCCONFIG_FILE="$FB_SDK_SRC"/tests/TestAppIdAndSecret.xcconfig
XCCONFIG_FILE="$FB_SDK_SRC"/Configurations/TestAppIdAndSecret.xcconfig

write_xcconfig "$XCCONFIG_FILE" "$1" "$2" "$3" "$4"

Expand Down
2 changes: 1 addition & 1 deletion scripts/productbuild_distribution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<pkg-ref id="com.facebook.sdk.pkg"/>
</choice>

<title>Facebook SDK 3.14.1 for iOS</title>
<title>Facebook SDK 3.15 for iOS</title>
<conclusion file="README.txt" mime-type="text/plain" />
<readme file="README.txt" mime-type="text/plain" />
<domains enable_currentUserHome="true" />
Expand Down
27 changes: 18 additions & 9 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# process options, valid arguments -c [Debug|Release] -n
BUILDCONFIGURATION=Debug
SCHEMES="facebook-ios-sdk-tests FacebookSDKIntegrationTests"
SCHEMES="facebook-ios-sdk-tests FacebookSDKIntegrationTests FacebookSDKApplicationTests"

while getopts ":nc:" OPTNAME
do
Expand All @@ -34,6 +34,7 @@ do
echo "SUITE: one or more of the following (default is all):"
echo " facebook-ios-sdk-tests: unit tests"
echo " FacebookSDKIntegrationTests: integration tests"
echo " FacebookSDKApplicationTests: application tests"
die
;;
"n")
Expand All @@ -56,15 +57,23 @@ if [ -n "$*" ]; then
SCHEMES="$*"
fi

test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'

cd "$FB_SDK_SRC"

test -d "$FB_SDK_BUILD" \
|| mkdir -p "$FB_SDK_BUILD" \
|| die "Could not create directory $FB_SDK_BUILD"

for SCHEME in $SCHEMES; do
$XCODEBUILD \
-sdk iphonesimulator \
-configuration $BUILDCONFIGURATION \
-scheme $SCHEME \
$CLEAN test \
|| die "Error while running unit tests"
"$XCTOOL" \
-project facebook-ios-sdk.xcodeproj \
-scheme $SCHEME \
-sdk iphonesimulator \
-configuration "$BUILDCONFIGURATION" \
ONLY_ACTIVE_ARCH=YES \
SYMROOT="$FB_SDK_BUILD" \
$CLEAN test \
-test-sdk iphonesimulator \
-simulator iphone \
|| die "Error while running unit tests"
done

21 changes: 21 additions & 0 deletions src/Configurations/FacebookSDK-64.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Copyright 2010-present Facebook.
//
// 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.
//

// Architectures
ARCHS = arm64 x86_64

// Deployment
IPHONEOS_DEPLOYMENT_TARGET = 7.0
Loading

0 comments on commit 3096a04

Please sign in to comment.