This commit is contained in:
giuseppenuc committed 2016-02-24 16:56:39 +01:00
1 parent d281d765ea
commit 5b074a5176
1261 files changed
+199158 -7303

No files matched your search

@@ -0,0 +1,13 @@
Switch User sample
Demonstrates an approach to allow switching between multiple users on, for example, a shared family iPad.
In this sample, we have the concept of a "Primary User" and up to three "Guest Users". The Primary User
authenticates using SSO, if possible, while the Guest Users are asked to login using their Facebook
credentials. Once authenticated, no further requests are made for user passwords, etc., so a solution
such as this would be applicable only in a scenario that implies a high degree of trust amongst the
various users.
Using the Sample
Install the Facebook SDK for iOS.
Launch the SwitchUsersSample project using Xcode from the <Facebook SDK>/samples/SwitchUsersSample directory.
@@ -0,0 +1,378 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
856DB04E153393C3006F6A33 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 856DB04D153393C3006F6A33 /* UIKit.framework */; };
856DB050153393C3006F6A33 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 856DB04F153393C3006F6A33 /* Foundation.framework */; };
856DB052153393C3006F6A33 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 856DB051153393C3006F6A33 /* CoreGraphics.framework */; };
856DB058153393C3006F6A33 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 856DB056153393C3006F6A33 /* InfoPlist.strings */; };
856DB05A153393C3006F6A33 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 856DB059153393C3006F6A33 /* main.m */; };
856DB05E153393C3006F6A33 /* SUAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 856DB05D153393C3006F6A33 /* SUAppDelegate.m */; };
856DB063153393C3006F6A33 /* first.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DB062153393C3006F6A33 /* first.png */; };
856DB065153393C3006F6A33 /* first@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DB064153393C3006F6A33 /* first@2x.png */; };
856DB06A153393C3006F6A33 /* second.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DB069153393C3006F6A33 /* second.png */; };
856DB06C153393C3006F6A33 /* second@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DB06B153393C3006F6A33 /* second@2x.png */; };
856DB0841534B72B006F6A33 /* SUUsingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 856DB0821534B72B006F6A33 /* SUUsingViewController.m */; };
856DB0851534B72B006F6A33 /* SUUsingViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 856DB0831534B72B006F6A33 /* SUUsingViewController_iPhone.xib */; };
856DB0871534B758006F6A33 /* SUUsingViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 856DB0861534B758006F6A33 /* SUUsingViewController_iPad.xib */; };
856DB08B1534B792006F6A33 /* SUSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 856DB0891534B792006F6A33 /* SUSettingsViewController.m */; };
856DB08C1534B792006F6A33 /* SUSettingsViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 856DB08A1534B792006F6A33 /* SUSettingsViewController_iPhone.xib */; };
856DB08E1534B7A0006F6A33 /* SUSettingsViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 856DB08D1534B7A0006F6A33 /* SUSettingsViewController_iPad.xib */; };
85AFB52F158FA20E000AF7F5 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 85AFB52B158FA20E000AF7F5 /* Icon-72.png */; };
85AFB530158FA20E000AF7F5 /* Icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85AFB52C158FA20E000AF7F5 /* Icon-72@2x.png */; };
85AFB531158FA20E000AF7F5 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 85AFB52D158FA20E000AF7F5 /* Icon.png */; };
85AFB532158FA20E000AF7F5 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85AFB52E158FA20E000AF7F5 /* Icon@2x.png */; };
85C69DBF1602B393008AD9A0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DBC1602B393008AD9A0 /* Default-568h@2x.png */; };
85C69DC01602B393008AD9A0 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DBD1602B393008AD9A0 /* Default.png */; };
85C69DC11602B393008AD9A0 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DBE1602B393008AD9A0 /* Default@2x.png */; };
85D0ED8C1538A9F400D88664 /* SUProfileTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 85D0ED8B1538A9F400D88664 /* SUProfileTableViewCell.m */; };
85D0ED8F1538BF6200D88664 /* SUUserManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 85D0ED8E1538BF6200D88664 /* SUUserManager.m */; };
DD55EAA515AB9D1A000A64B8 /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD55EAA415AB9D1A000A64B8 /* FacebookSDK.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
856DB049153393C3006F6A33 /* SwitchUserSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwitchUserSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
856DB04D153393C3006F6A33 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
856DB04F153393C3006F6A33 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
856DB051153393C3006F6A33 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
856DB055153393C3006F6A33 /* SwitchUserSample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SwitchUserSample-Info.plist"; sourceTree = "<group>"; };
856DB057153393C3006F6A33 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
856DB059153393C3006F6A33 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
856DB05B153393C3006F6A33 /* SwitchUserSample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwitchUserSample-Prefix.pch"; sourceTree = "<group>"; };
856DB05C153393C3006F6A33 /* SUAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUAppDelegate.h; sourceTree = "<group>"; };
856DB05D153393C3006F6A33 /* SUAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUAppDelegate.m; sourceTree = "<group>"; };
856DB062153393C3006F6A33 /* first.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = first.png; sourceTree = "<group>"; };
856DB064153393C3006F6A33 /* first@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "first@2x.png"; sourceTree = "<group>"; };
856DB069153393C3006F6A33 /* second.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = second.png; sourceTree = "<group>"; };
856DB06B153393C3006F6A33 /* second@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "second@2x.png"; sourceTree = "<group>"; };
856DB0811534B72B006F6A33 /* SUUsingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUsingViewController.h; sourceTree = "<group>"; };
856DB0821534B72B006F6A33 /* SUUsingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUsingViewController.m; sourceTree = "<group>"; };
856DB0831534B72B006F6A33 /* SUUsingViewController_iPhone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUsingViewController_iPhone.xib; sourceTree = "<group>"; };
856DB0861534B758006F6A33 /* SUUsingViewController_iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUsingViewController_iPad.xib; sourceTree = "<group>"; };
856DB0881534B792006F6A33 /* SUSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSettingsViewController.h; sourceTree = "<group>"; };
856DB0891534B792006F6A33 /* SUSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSettingsViewController.m; sourceTree = "<group>"; };
856DB08A1534B792006F6A33 /* SUSettingsViewController_iPhone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUSettingsViewController_iPhone.xib; sourceTree = "<group>"; };
856DB08D1534B7A0006F6A33 /* SUSettingsViewController_iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUSettingsViewController_iPad.xib; sourceTree = "<group>"; };
85AFB52B158FA20E000AF7F5 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
85AFB52C158FA20E000AF7F5 /* Icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72@2x.png"; sourceTree = "<group>"; };
85AFB52D158FA20E000AF7F5 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
85AFB52E158FA20E000AF7F5 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
85C69DBC1602B393008AD9A0 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
85C69DBD1602B393008AD9A0 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
85C69DBE1602B393008AD9A0 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
85D0ED8A1538A9F400D88664 /* SUProfileTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUProfileTableViewCell.h; sourceTree = "<group>"; };
85D0ED8B1538A9F400D88664 /* SUProfileTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUProfileTableViewCell.m; sourceTree = "<group>"; };
85D0ED8D1538BF6200D88664 /* SUUserManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserManager.h; sourceTree = "<group>"; };
85D0ED8E1538BF6200D88664 /* SUUserManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUserManager.m; sourceTree = "<group>"; };
DD55EAA415AB9D1A000A64B8 /* FacebookSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FacebookSDK.framework; path = ../../build/FacebookSDK.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
856DB046153393C3006F6A33 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
856DB04E153393C3006F6A33 /* UIKit.framework in Frameworks */,
856DB050153393C3006F6A33 /* Foundation.framework in Frameworks */,
856DB052153393C3006F6A33 /* CoreGraphics.framework in Frameworks */,
DD55EAA515AB9D1A000A64B8 /* FacebookSDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
856DB03E153393C3006F6A33 = {
isa = PBXGroup;
children = (
856DB053153393C3006F6A33 /* SwitchUserSample */,
856DB04C153393C3006F6A33 /* Frameworks */,
856DB04A153393C3006F6A33 /* Products */,
);
indentWidth = 4;
sourceTree = "<group>";
tabWidth = 4;
};
856DB04A153393C3006F6A33 /* Products */ = {
isa = PBXGroup;
children = (
856DB049153393C3006F6A33 /* SwitchUserSample.app */,
);
name = Products;
sourceTree = "<group>";
};
856DB04C153393C3006F6A33 /* Frameworks */ = {
isa = PBXGroup;
children = (
DD55EAA415AB9D1A000A64B8 /* FacebookSDK.framework */,
856DB04D153393C3006F6A33 /* UIKit.framework */,
856DB04F153393C3006F6A33 /* Foundation.framework */,
856DB051153393C3006F6A33 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
856DB053153393C3006F6A33 /* SwitchUserSample */ = {
isa = PBXGroup;
children = (
856DB05C153393C3006F6A33 /* SUAppDelegate.h */,
856DB05D153393C3006F6A33 /* SUAppDelegate.m */,
85D0ED8A1538A9F400D88664 /* SUProfileTableViewCell.h */,
85D0ED8B1538A9F400D88664 /* SUProfileTableViewCell.m */,
856DB0881534B792006F6A33 /* SUSettingsViewController.h */,
856DB0891534B792006F6A33 /* SUSettingsViewController.m */,
85D0ED8D1538BF6200D88664 /* SUUserManager.h */,
85D0ED8E1538BF6200D88664 /* SUUserManager.m */,
856DB0811534B72B006F6A33 /* SUUsingViewController.h */,
856DB0821534B72B006F6A33 /* SUUsingViewController.m */,
856DB062153393C3006F6A33 /* first.png */,
856DB064153393C3006F6A33 /* first@2x.png */,
856DB069153393C3006F6A33 /* second.png */,
856DB06B153393C3006F6A33 /* second@2x.png */,
856DB08A1534B792006F6A33 /* SUSettingsViewController_iPhone.xib */,
856DB08D1534B7A0006F6A33 /* SUSettingsViewController_iPad.xib */,
856DB0831534B72B006F6A33 /* SUUsingViewController_iPhone.xib */,
856DB0861534B758006F6A33 /* SUUsingViewController_iPad.xib */,
856DB054153393C3006F6A33 /* Supporting Files */,
);
path = SwitchUserSample;
sourceTree = "<group>";
};
856DB054153393C3006F6A33 /* Supporting Files */ = {
isa = PBXGroup;
children = (
85C69DBC1602B393008AD9A0 /* Default-568h@2x.png */,
85C69DBD1602B393008AD9A0 /* Default.png */,
85C69DBE1602B393008AD9A0 /* Default@2x.png */,
85AFB52B158FA20E000AF7F5 /* Icon-72.png */,
85AFB52C158FA20E000AF7F5 /* Icon-72@2x.png */,
85AFB52D158FA20E000AF7F5 /* Icon.png */,
85AFB52E158FA20E000AF7F5 /* Icon@2x.png */,
856DB055153393C3006F6A33 /* SwitchUserSample-Info.plist */,
856DB056153393C3006F6A33 /* InfoPlist.strings */,
856DB059153393C3006F6A33 /* main.m */,
856DB05B153393C3006F6A33 /* SwitchUserSample-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
856DB048153393C3006F6A33 /* SwitchUserSample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 856DB07B153393C4006F6A33 /* Build configuration list for PBXNativeTarget "SwitchUserSample" */;
buildPhases = (
856DB045153393C3006F6A33 /* Sources */,
856DB046153393C3006F6A33 /* Frameworks */,
856DB047153393C3006F6A33 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SwitchUserSample;
productName = SwitchUserSample;
productReference = 856DB049153393C3006F6A33 /* SwitchUserSample.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
856DB040153393C3006F6A33 /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = SU;
LastUpgradeCheck = 0430;
};
buildConfigurationList = 856DB043153393C3006F6A33 /* Build configuration list for PBXProject "SwitchUserSample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
he,
);
mainGroup = 856DB03E153393C3006F6A33;
productRefGroup = 856DB04A153393C3006F6A33 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
856DB048153393C3006F6A33 /* SwitchUserSample */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
856DB047153393C3006F6A33 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
856DB058153393C3006F6A33 /* InfoPlist.strings in Resources */,
856DB063153393C3006F6A33 /* first.png in Resources */,
856DB065153393C3006F6A33 /* first@2x.png in Resources */,
856DB06A153393C3006F6A33 /* second.png in Resources */,
856DB06C153393C3006F6A33 /* second@2x.png in Resources */,
856DB0851534B72B006F6A33 /* SUUsingViewController_iPhone.xib in Resources */,
856DB0871534B758006F6A33 /* SUUsingViewController_iPad.xib in Resources */,
856DB08C1534B792006F6A33 /* SUSettingsViewController_iPhone.xib in Resources */,
856DB08E1534B7A0006F6A33 /* SUSettingsViewController_iPad.xib in Resources */,
85AFB52F158FA20E000AF7F5 /* Icon-72.png in Resources */,
85AFB530158FA20E000AF7F5 /* Icon-72@2x.png in Resources */,
85AFB531158FA20E000AF7F5 /* Icon.png in Resources */,
85AFB532158FA20E000AF7F5 /* Icon@2x.png in Resources */,
85C69DBF1602B393008AD9A0 /* Default-568h@2x.png in Resources */,
85C69DC01602B393008AD9A0 /* Default.png in Resources */,
85C69DC11602B393008AD9A0 /* Default@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
856DB045153393C3006F6A33 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
856DB05A153393C3006F6A33 /* main.m in Sources */,
856DB05E153393C3006F6A33 /* SUAppDelegate.m in Sources */,
856DB0841534B72B006F6A33 /* SUUsingViewController.m in Sources */,
856DB08B1534B792006F6A33 /* SUSettingsViewController.m in Sources */,
85D0ED8C1538A9F400D88664 /* SUProfileTableViewCell.m in Sources */,
85D0ED8F1538BF6200D88664 /* SUUserManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
856DB056153393C3006F6A33 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
856DB057153393C3006F6A33 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
856DB079153393C4006F6A33 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
856DB07A153393C4006F6A33 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
856DB07C153393C4006F6A33 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../build\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SwitchUserSample/SwitchUserSample-Prefix.pch";
INFOPLIST_FILE = "SwitchUserSample/SwitchUserSample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_LDFLAGS = (
"-Wall",
"-ObjC",
);
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
856DB07D153393C4006F6A33 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../build\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SwitchUserSample/SwitchUserSample-Prefix.pch";
INFOPLIST_FILE = "SwitchUserSample/SwitchUserSample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_LDFLAGS = (
"-Wall",
"-ObjC",
);
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
856DB043153393C3006F6A33 /* Build configuration list for PBXProject "SwitchUserSample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
856DB079153393C4006F6A33 /* Debug */,
856DB07A153393C4006F6A33 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
856DB07B153393C4006F6A33 /* Build configuration list for PBXNativeTarget "SwitchUserSample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
856DB07C153393C4006F6A33 /* Debug */,
856DB07D153393C4006F6A33 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 856DB040153393C3006F6A33 /* Project object */;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

@@ -0,0 +1,40 @@
/*
* 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.
*/
#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>
#import "SUUserManager.h"
// Switch User sample application
//
// The purpose of this sample application is show a more advanced use of
// FBSession to manage tokens of multiple users. The idea behind this scenario
// is an application which supports devices shared by multiple users (e.g. the
// family iPad), and which remembers multiple users and lets the users easily
// switch the currently active user
@interface SUAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITabBarController *tabBarController;
// FBSample logic
// The SUUserManager class is a custom type included with this sample that shows
// lightweight user-management performed by an application, which utilizes
// FBSession to manage login workflow and integration with Facebook
@property (strong, nonatomic) SUUserManager *userManager;
@end
@@ -0,0 +1,79 @@
/*
* 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.
*/
#import "SUAppDelegate.h"
#import "SUUsingViewController.h"
#import "SUSettingsViewController.h"
@implementation SUAppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
@synthesize userManager = _userManager;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// FBSample logic
// Creates an instance of the SUUserManager class, used to manage multiple user logins; note that this
// application does not attempt to maintain multiple active users at once; however it does remember
// multiple users that have at one time or another logged onto facebook from the application; at any one
// time there is only a single active user
self.userManager = [[SUUserManager alloc] init];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
SUUsingViewController *viewController1;
SUSettingsViewController *viewController2;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
viewController1 = [[SUUsingViewController alloc] initWithNibName:@"SUUsingViewController_iPhone" bundle:nil];
viewController2 = [[SUSettingsViewController alloc] initWithNibName:@"SUSettingsViewController_iPhone" bundle:nil];
} else {
viewController1 = [[SUUsingViewController alloc] initWithNibName:@"SUUsingViewController_iPad" bundle:nil];
viewController2 = [[SUSettingsViewController alloc] initWithNibName:@"SUSettingsViewController_iPad" bundle:nil];
}
viewController2.wantsFullScreenLayout = YES;
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
// FBSample logic
// At startup time we attempt to log in the default user that has signed on using Facebook Login
[viewController2 loginDefaultUser];
return YES;
}
// FBSample logic
// As part of the login workflow, the native application or Safari will transition back to this application'
// this method is then called, which defers the responsibility of parsing the url to the handleOpenURL method
// of FBSession
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:self.userManager.currentSession];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBAppEvents activateApp];
[FBAppCall handleDidBecomeActiveWithSession:self.userManager.currentSession];
}
@end
@@ -0,0 +1,25 @@
/*
* 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.
*/
#import <UIKit/UIKit.h>
@interface SUProfileTableViewCell : UITableViewCell
@property (copy, nonatomic) NSString *userID;
@property (copy, nonatomic) NSString *userName;
@property (readonly) CGFloat desiredHeight;
@end
@@ -0,0 +1,124 @@
/*
* 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.
*/
#import "SUProfileTableViewCell.h"
#import <FacebookSDK/FacebookSDK.h>
static const CGFloat leftMargin = 10;
static const CGFloat topMargin = 5;
static const CGFloat rightMargin = 30;
static const CGFloat pictureWidth = 50;
static const CGFloat pictureHeight = 50;
@interface SUProfileTableViewCell ()
// FBSample logic
// This view is used to display the profile pictures within the list of user accounts
@property (strong, nonatomic) FBProfilePictureView *profilePic;
- (void)initializeSubViews;
@end
@implementation SUProfileTableViewCell
@synthesize profilePic = _profilePic;
#pragma mark - Lifecycle
- (void)dealloc {
[_profilePic removeFromSuperview];
}
- (id)init {
self = [super init];
if (self) {
[self initializeSubViews];
}
return self;
}
- (id)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initializeSubViews];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark -
- (void)initializeSubViews {
FBProfilePictureView *profilePic = [[FBProfilePictureView alloc]
initWithFrame:CGRectMake(
leftMargin,
topMargin,
pictureWidth,
pictureHeight)];
[self addSubview:profilePic];
self.profilePic = profilePic;
self.clipsToBounds = YES;
self.autoresizesSubviews = YES;
}
- (void) layoutSubviews {
[super layoutSubviews];
CGSize size = self.bounds.size;
self.textLabel.frame = CGRectMake(
leftMargin * 2 + pictureWidth,
topMargin,
size.width - leftMargin - pictureWidth - rightMargin,
size.height - topMargin);
}
#pragma mark - Properties
- (NSString*)userID {
return self.profilePic.profileID;
}
- (void)setUserID:(NSString *)userID {
// FBSample logic
// Setting the profileID property of the profile picture view causes the view to fetch and display
// the profile picture for the given user
self.profilePic.profileID = userID;
}
- (NSString*)userName {
return self.textLabel.text;
}
- (void)setUserName:(NSString *)userName {
self.textLabel.text = userName;
}
- (CGFloat)desiredHeight {
return topMargin * 2 + pictureHeight;
}
@end
@@ -0,0 +1,23 @@
/*
* 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.
*/
#import <UIKit/UIKit.h>
@interface SUSettingsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
- (void)loginDefaultUser;
@end
@@ -0,0 +1,317 @@
/*
* 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.
*/
#import "SUSettingsViewController.h"
#import "SUAppDelegate.h"
#import "SUProfileTableViewCell.h"
#import <FacebookSDK/FacebookSDK.h>
@interface SUSettingsViewController ()
@property (strong, nonatomic) IBOutlet UITableView *usersTableView;
// FBSample logic
// The app fetches https://graph.facebook.com/me for a user account immedately after successful login;
// the request object is cached in this property in order to have a means for canceling and identifying
// the network request while it is in flight
@property (strong, nonatomic) FBRequest *pendingRequest;
@property (nonatomic) int pendingLoginForSlot;
- (int)userSlotFromIndexPath:(NSIndexPath *)indexPath;
- (void)loginSlot:(int)slot;
- (NSIndexPath*)indexPathFromUserSlot:(int)slot;
@end
@implementation SUSettingsViewController
@synthesize usersTableView;
@synthesize pendingRequest = _pendingRequest;
@synthesize pendingLoginForSlot = _pendingLoginForSlot;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Settings", @"Settings");
self.tabBarItem.image = [UIImage imageNamed:@"second"];
self.pendingLoginForSlot = -1;
}
return self;
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.usersTableView.delegate = nil;
self.usersTableView.dataSource = nil;
self.usersTableView = nil;
}
- (void)loginDefaultUser {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
if (![userManager isSlotEmpty:0]) {
[self loginSlot:0];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
- (void)updateCell:(SUProfileTableViewCell *)cell
forSlot:(int)slot {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
NSString *userID = [userManager getUserIDInSlot:slot];
cell.accessoryType = UITableViewCellAccessoryNone;
if (userID == nil) {
cell.userName = @"Empty slot";
cell.userID = nil;
} else {
if (slot == self.pendingLoginForSlot) {
cell.userName = @"Logging in...";
} else {
cell.userName = [userManager getUserNameInSlot:slot];
}
cell.userID = userID;
if (slot == [userManager currentUserSlot]) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
}
- (void)updateCellForSlot:(int)slot {
SUProfileTableViewCell *cell = (SUProfileTableViewCell *)[self.usersTableView cellForRowAtIndexPath:
[self indexPathFromUserSlot:slot]];
[self updateCell:cell forSlot:slot];
}
- (void)updateForSessionChangeForSlot:(int)slot {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
// FBSample logic
// Get the current session from the userManager
FBSession *session = userManager.currentSession;
if (session.isOpen) {
// fetch profile info such as name, id, etc. for the open session
FBRequest *me = [[FBRequest alloc] initWithSession:session
graphPath:@"me"];
self.pendingRequest= me;
[me startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *result,
NSError *error) {
// because we have a cached copy of the connection, we can check
// to see if this is the connection we care about; a prematurely
// cancelled connection will short-circuit here
if (me != self.pendingRequest) {
return;
}
self.pendingRequest = nil;
self.pendingLoginForSlot = -1;
// we interpret an error in the initial fetch as a reason to
// fail the user switch, and leave the application without an
// active user (similar to initial state)
if (error) {
NSLog(@"Couldn't switch user: %@", error.localizedDescription);
[userManager switchToNoActiveUser];
return;
}
[userManager updateUser:result inSlot:slot];
[self updateCellForSlot:slot];
}];
} else {
// in the closed case, we check to see if we picked up a cached token that we
// expect to be valid and ready for use; if so then we open the session on the spot
if (session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
[self updateForSessionChangeForSlot:slot];
}];
}
}
}
- (void)loginSlot:(int)slot {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
if (slot < 0 || slot >= userManager.maximumUserSlots) {
return;
}
int currentUserSlot = userManager.currentUserSlot;
// If we can't log in as new user, we don't want to still be logged in as previous user,
// particularly if it might not be obvious to the user that the login failed.
[userManager switchToNoActiveUser];
self.pendingLoginForSlot = slot;
if (slot != currentUserSlot) {
// Update the previously active user's cell
if (currentUserSlot >= 0 && currentUserSlot < [userManager maximumUserSlots]) {
[self updateCellForSlot:currentUserSlot];
}
}
// FBSample logic
// We assume that the primary user is going to log on via Facebook Login, while guest users will
// specify their name via the login dialog (Fallback Facebook Login.) The decision of when to try
// Facebook Login vs. Fallback (force entering of credentials) will be specific to the needs of
// an app; this app bases the decision on whether the user logs on the "primary user" or a "guest user"
FBSessionLoginBehavior behavior = (slot == 0) ?
FBSessionLoginBehaviorWithFallbackToWebView :
FBSessionLoginBehaviorForcingWebView;
FBSession *session = [userManager switchToUserInSlot:slot];
[self updateCellForSlot:slot];
// we pass the correct behavior here to indicate the login workflow to use (Facebook Login, fallback, etc.)
[session openWithBehavior:behavior
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// this handler is called back whether the login succeeds or fails; in the
// success case it will also be called back upon each state transition between
// session-open and session-close
if (error) {
[userManager switchToNoActiveUser];
}
[self updateForSessionChangeForSlot:slot];
}];
}
- (int)userSlotFromIndexPath:(NSIndexPath *)indexPath {
// This relies on the fact that there's only one user in the first section.
return indexPath.section + indexPath.row;
}
- (NSIndexPath*)indexPathFromUserSlot:(int)slot {
// See comment in userSlotFromIndexPath:
return [NSIndexPath indexPathForRow:(slot == 0) ? 0 : (slot - 1)
inSection:(slot == 0) ? 0 : 1];
}
#pragma mark UITableViewDataSource methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
switch (section) {
case 0:
return 1;
default:
return [userManager maximumUserSlots] - 1;
}
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
SUProfileTableViewCell *cell = (SUProfileTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[SUProfileTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
SUAppDelegate *appDelegate = (SUAppDelegate*)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
int slot = [self userSlotFromIndexPath:indexPath];
if (slot >= 0 && slot < [userManager maximumUserSlots] ) {
[self updateCell:cell forSlot:slot];
}
return cell;
}
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
switch (section) {
case 0:
return @"Primary User:";
default:
return @"Guest Users:";
}
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
SUAppDelegate *appDelegate = (SUAppDelegate*)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = [appDelegate userManager];
return [userManager getUserIDInSlot:[self userSlotFromIndexPath:indexPath]] != nil;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
SUAppDelegate *appDelegate = (SUAppDelegate*)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = [appDelegate userManager];
if (editingStyle == UITableViewCellEditingStyleDelete) {
int slot = [self userSlotFromIndexPath:indexPath];
[userManager updateUser:nil inSlot:slot];
[self updateCellForSlot:slot];
}
}
#pragma mark -
#pragma mark UITableViewDelegate methods
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
SUProfileTableViewCell *cell = (SUProfileTableViewCell*)[self tableView:tableView
cellForRowAtIndexPath:indexPath];
return cell.desiredHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SUAppDelegate *appDelegate = (SUAppDelegate*)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = [appDelegate userManager];
int currentUserSlot = userManager.currentUserSlot;
int slot = [self userSlotFromIndexPath:indexPath];
if (slot == currentUserSlot) {
[userManager switchToNoActiveUser];
[self updateCellForSlot:slot];
} else {
[self loginSlot:slot];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
return;
}
- (NSString*)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"Forget";
}
#pragma mark -
@end
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">12E55</string>
<string key="IBDocument.InterfaceBuilderVersion">4504</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">3734.1</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUITableView</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUITableView" id="404474561">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 20}, {768, 984}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIAlwaysBounceVertical">YES</bool>
<int key="IBUISeparatorStyle">1</int>
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">22</float>
<float key="IBUISectionFooterHeight">22</float>
</object>
</array>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="404474561"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<bool key="usesAutoincrementingIDs">NO</bool>
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">usersTableView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="404474561"/>
</object>
<string key="id">4</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<string key="id">7</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="404474561"/>
<reference key="destination" ref="372490531"/>
</object>
<string key="id">5</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">dataSource</string>
<reference key="source" ref="404474561"/>
<reference key="destination" ref="372490531"/>
</object>
<string key="id">6</string>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<string key="id">0</string>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<string key="id">1</string>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="404474561"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">-1</string>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<string key="id">-2</string>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">3</string>
<reference key="object" ref="404474561"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">SUSettingsViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">SUSettingsViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">usersTableView</string>
<string key="NS.object.0">UITableView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">usersTableView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">usersTableView</string>
<string key="candidateClassName">UITableView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/SUSettingsViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1280" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3734.1</string>
</data>
</archive>
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">12E55</string>
<string key="IBDocument.InterfaceBuilderVersion">4504</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">3734.1</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUITableView</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="451047833">
<object class="IBProxyObject" id="708008470">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="545423854">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="533399505">
<reference key="NSNextResponder"/>
<int key="NSvFlags">1298</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUITableView" id="489447082">
<reference key="NSNextResponder" ref="533399505"/>
<int key="NSvFlags">1298</int>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrame">{{0, 20}, {320, 440}}</string>
<reference key="NSSuperview" ref="533399505"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIAlwaysBounceVertical">YES</bool>
<int key="IBUISeparatorStyle">1</int>
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">22</float>
<float key="IBUISectionFooterHeight">22</float>
</object>
</array>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<bool key="usesAutoincrementingIDs">NO</bool>
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">usersTableView</string>
<reference key="source" ref="708008470"/>
<reference key="destination" ref="489447082"/>
</object>
<string key="id">11</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="708008470"/>
<reference key="destination" ref="533399505"/>
</object>
<string key="id">3</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">dataSource</string>
<reference key="source" ref="489447082"/>
<reference key="destination" ref="708008470"/>
</object>
<string key="id">7</string>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="489447082"/>
<reference key="destination" ref="708008470"/>
</object>
<string key="id">8</string>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<string key="id">0</string>
<array key="object" id="0"/>
<reference key="children" ref="451047833"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<string key="id">-1</string>
<reference key="object" ref="708008470"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<string key="id">-2</string>
<reference key="object" ref="545423854"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">1</string>
<reference key="object" ref="533399505"/>
<array class="NSMutableArray" key="children">
<reference ref="489447082"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">4</string>
<reference key="object" ref="489447082"/>
<reference key="parent" ref="533399505"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">SUSettingsViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<boolean value="NO" key="-1.showNotes"/>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<boolean value="NO" key="-2.showNotes"/>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<reference key="1.IBUserGuides" ref="0"/>
<boolean value="NO" key="1.showNotes"/>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<reference key="4.IBUserGuides" ref="0"/>
<boolean value="NO" key="4.showNotes"/>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">SUSettingsViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">usersTableView</string>
<string key="NS.object.0">UITableView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">usersTableView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">usersTableView</string>
<string key="candidateClassName">UITableView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/SUSettingsViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1280" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3734.1</string>
</data>
</archive>
@@ -0,0 +1,44 @@
/*
* 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.
*/
#import <Foundation/Foundation.h>
#import <FacebookSDK/FacebookSDK.h>
extern NSString *const SUInvalidSlotNumber;
@protocol FBGraphUser;
@interface SUUserManager : NSObject
@property (readonly) int maximumUserSlots;
// FBSample logic
// This is where our active session is maintained
@property (strong, readonly) FBSession *currentSession;
@property (readonly) int currentUserSlot;
- (id)init;
- (NSString*)getUserIDInSlot:(int)slot;
- (NSString*)getUserNameInSlot:(int)slot;
- (void)updateUser:(NSDictionary<FBGraphUser> *)user inSlot:(int)slot;
- (BOOL)isSlotEmpty:(int)slot;
- (BOOL)areAllSlotsEmpty;
- (void)switchToNoActiveUser;
- (FBSession *)switchToUserInSlot:(int)slot;
@end
@@ -0,0 +1,176 @@
/*
* 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.
*/
#import "SUUserManager.h"
#import <FacebookSDK/FBSessionTokenCachingStrategy.h>
#import <FacebookSDK/FacebookSDK.h>
NSString *const SUInvalidSlotNumber = @"com.facebook.SwitchUserSample:InvalidSlotNumber";
static NSString *const SUUserIDKeyFormat = @"SUUserID%d";
static NSString *const SUUserNameKeyFormat = @"SUUserName%d";
@implementation SUUserManager
@synthesize currentSession = _currentSession;
@synthesize currentUserSlot = _currentUserSlot;
- (id)init {
self = [super init];
if (self) {
_currentUserSlot = -1;
}
return self;
}
- (void)sendNotification {
[[NSNotificationCenter defaultCenter] postNotificationName:@"SUUserManagerUserChanged"
object:nil];
}
- (void)validateSlotNumber:(int)slot {
if (slot < 0 || slot >= [self maximumUserSlots]) {
[[NSException exceptionWithName:SUInvalidSlotNumber
reason:[NSString stringWithFormat:@"Invalid slot number %d specified", slot]
userInfo:nil]
raise];
}
}
- (int)maximumUserSlots {
return 4;
}
- (FBSessionTokenCachingStrategy*)createCachingStrategyForSlot:(int)slot {
// FBSample logic
// Token caching strategies are an advanced feature of the SDK; by creating one and passing it to
// FBSession at instantiation time, the SUUserManager class takes control of the token caching
// behavior of session instances; this is useful to do in this application, because there may be up
// to four users whose tokens are remembered by the application at one time; and so the names in
// NSUserDefaults used to store these values need to reflect the user whose data is being cached
// Note: an application with more advanced token caching needs (beyond NSUserDefaults) can derive
// from FBSessionTokenCachingStrategy, and implement any store for the token cache that it needs,
// including storing and retrieving tokens on an application-specific server, filesystem, etc.
FBSessionTokenCachingStrategy *tokenCachingStrategy = [[FBSessionTokenCachingStrategy alloc]
initWithUserDefaultTokenInformationKeyName:[NSString stringWithFormat:@"SUUserTokenInfo%d", slot]];
return tokenCachingStrategy;
}
- (BOOL)isSlotEmpty:(int)slot {
return [self getUserIDInSlot:slot] == nil;
}
- (BOOL)areAllSlotsEmpty {
int numSlots = [self maximumUserSlots];
for (int i = 0; i < numSlots; ++i) {
if ([self isSlotEmpty:i] == NO) {
return NO;
}
}
return YES;
}
- (FBSession*)createSessionForSlot:(int)slot {
// FBSample logic
// Getting the right strategy instance for the right slot matters for this application
FBSessionTokenCachingStrategy *tokenCachingStrategy = [self createCachingStrategyForSlot:slot];
// create a session object, with defaults accross the board, except that we provide a custom
// instance of FBSessionTokenCachingStrategy
FBSession *session = [[FBSession alloc] initWithAppID:nil
permissions:@[@"basic_info",@"user_birthday"]
urlSchemeSuffix:nil
tokenCacheStrategy:tokenCachingStrategy];
return session;
}
- (NSString*)getUserNameInSlot:(int)slot {
[self validateSlotNumber:slot];
NSString *key = [NSString stringWithFormat:SUUserNameKeyFormat, slot];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Don't assume we have a full FBGraphObject -- builds compiled with earlier versions of SDK
// may have saved only a plain NSDictionary.
return [defaults objectForKey:key];
}
- (NSString*)getUserIDInSlot:(int)slot {
[self validateSlotNumber:slot];
NSString *key = [NSString stringWithFormat:SUUserIDKeyFormat, slot];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Don't assume we have a full FBGraphObject -- builds compiled with earlier versions of SDK
// may have saved only a plain NSDictionary.
return [defaults objectForKey:key];
}
- (void)updateUser:(NSDictionary<FBGraphUser> *)user inSlot:(int)slot {
[self validateSlotNumber:slot];
NSString *idKey = [NSString stringWithFormat:SUUserIDKeyFormat, slot];
NSString *nameKey = [NSString stringWithFormat:SUUserNameKeyFormat, slot];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (user != nil ) {
NSLog(@"SUUserManager updating slot %d: fbid = %@, name = %@", slot, user.id, user.name);
[defaults setObject:user.id forKey:idKey];
[defaults setObject:user.name forKey:nameKey];
} else {
NSLog(@"SUUserManager clearing slot %d", slot);
// Can't be current user anymore
if (slot == _currentUserSlot) {
[self switchToNoActiveUser];
}
// FBSample logic
// Also need to tell the token cache to forget the tokens for this user
FBSessionTokenCachingStrategy *tokenCachingStrategy = [self createCachingStrategyForSlot:slot];
[tokenCachingStrategy clearToken];
[defaults removeObjectForKey:idKey];
[defaults removeObjectForKey:nameKey];
}
[defaults synchronize];
[self sendNotification];
}
- (void)switchToNoActiveUser {
NSLog(@"SUUserManager switching to no active user");
_currentSession = nil;
_currentUserSlot = -1;
[self sendNotification];
}
- (FBSession *)switchToUserInSlot:(int)slot {
[self validateSlotNumber:slot];
NSLog(@"SUUserManager switching to slot %d", slot);
FBSession *session = [self createSessionForSlot:slot];
_currentSession = session;
_currentUserSlot = slot;
[self sendNotification];
return session;
}
@end
@@ -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.
*/
#import <UIKit/UIKit.h>
@interface SUUsingViewController : UIViewController
@end
@@ -0,0 +1,145 @@
/*
* 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.
*/
#import "SUUsingViewController.h"
#import "SUAppDelegate.h"
#import <FacebookSDK/FacebookSDK.h>
@interface SUUsingViewController ()
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *birthdayLabel;
// FBSample logic
// The requestConnection property in this class is used to maintain the current active
// connection with Facebook, used to fetch profile information; and picView displays the
// profile for the current active user
@property (strong, nonatomic) FBRequest *pendingRequest;
@property (strong, nonatomic) IBOutlet FBProfilePictureView *picView;
@end
@implementation SUUsingViewController
@synthesize nameLabel;
@synthesize birthdayLabel;
@synthesize picView;
@synthesize pendingRequest = _pendingRequest;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Using", @"Using");
self.tabBarItem.image = [UIImage imageNamed:@"first"];
}
return self;
}
- (void)updateControls {
SUAppDelegate *appDelegate = (SUAppDelegate *)[[UIApplication sharedApplication]delegate];
SUUserManager *userManager = appDelegate.userManager;
if (userManager.currentUserSlot != -1 &&
userManager.currentSession.isOpen) {
// There could be a delay while we retrieve user profile. Hide controls until data is there.
self.nameLabel.hidden = YES;
self.picView.hidden = YES;
self.birthdayLabel.hidden = YES;
// FBSample logic
// If the session is open, then we attemt to fetch /me, in order to get the user's
// name and birthday
FBRequest *me = [[FBRequest alloc] initWithSession:userManager.currentSession
graphPath:@"me"];
[me startWithCompletionHandler:^(FBRequestConnection *connection,
// we expect a user as a result, and so are using FBGraphUser protocol
// as our result type; in order to allow us to access first_name and
// birthday with property syntax
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (me != self.pendingRequest) {
return;
}
self.pendingRequest = nil;
if (error) {
NSLog(@"Couldn't get info : %@", error.localizedDescription);
return;
}
self.nameLabel.text = [NSString stringWithFormat:@"Hello, %@!", user.first_name];
self.picView.profileID = user.id;
if (user.birthday.length > 0) {
self.birthdayLabel.text = [NSString stringWithFormat:@"Your birthday is: %@", user.birthday];
} else {
self.birthdayLabel.text = @"Your birthday isn't set.";
}
self.nameLabel.hidden = NO;
self.picView.hidden = NO;
self.birthdayLabel.hidden = NO;
}];
self.pendingRequest = me;
} else {
self.nameLabel.text = @"No active user. Go to Settings tab to log in!";
self.nameLabel.hidden = NO;
self.picView.hidden = YES;
self.birthdayLabel.hidden = YES;
}
}
- (void)userDidChange:(NSNotification *)notification {
[self updateControls];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self updateControls];
}
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userDidChange:)
name:@"SUUserManagerUserChanged" object:nil];
[self updateControls];
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.nameLabel = nil;
self.birthdayLabel = nil;
self.picView = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self
name:@"SUUserManagerUserChanged" object:nil];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
@end
@@ -0,0 +1,270 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11D50d</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1179</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUILabel</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUILabel" id="358917850">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 12}, {280, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="160753864"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<string key="IBUIText">Label</string>
<object class="NSColor" key="IBUITextColor" id="799517355">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="1067190739">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="548304482">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="77831160">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 208}, {280, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<string key="IBUIText">Label</string>
<reference key="IBUITextColor" ref="799517355"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="1067190739"/>
<reference key="IBUIFont" ref="548304482"/>
</object>
<object class="IBUIView" id="160753864">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 51}, {150, 150}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="77831160"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="1035426529">
<int key="NSID">2</int>
</object>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="358917850"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="1035426529"/>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">birthdayLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="77831160"/>
</object>
<int key="connectionID">6</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">nameLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="358917850"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">picView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="160753864"/>
</object>
<int key="connectionID">8</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">9</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="358917850"/>
<reference ref="77831160"/>
<reference ref="160753864"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="358917850"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="77831160"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="160753864"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">SUUsingViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.CustomClassName">FBProfilePictureView</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">9</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">FBProfilePictureView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/FBProfilePictureView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SUUsingViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="birthdayLabel">UILabel</string>
<string key="nameLabel">UILabel</string>
<string key="picView">FBProfilePictureView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="birthdayLabel">
<string key="name">birthdayLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="nameLabel">
<string key="name">nameLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="picView">
<string key="name">picView</string>
<string key="candidateClassName">FBProfilePictureView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/SUUsingViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1179</string>
</data>
</archive>
@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11D50d</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1179</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUILabel</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUILabel" id="838902419">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {280, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="86048327"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Label</string>
<object class="NSColor" key="IBUITextColor" id="753450401">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="485455969">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="963293318">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="801206618">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 215}, {280, 31}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Label</string>
<reference key="IBUITextColor" ref="753450401"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="485455969"/>
<reference key="IBUIFont" ref="963293318"/>
</object>
<object class="IBUIView" id="86048327">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 59}, {150, 150}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="801206618"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="996871348">
<int key="NSID">2</int>
</object>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="838902419"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="996871348"/>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">nameLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="838902419"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">birthdayLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="801206618"/>
</object>
<int key="connectionID">8</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">picView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="86048327"/>
</object>
<int key="connectionID">9</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="838902419"/>
<reference ref="86048327"/>
<reference ref="801206618"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="838902419"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="86048327"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="801206618"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">SUUsingViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.CustomClassName">FBProfilePictureView</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">9</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">FBProfilePictureView</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/FBProfilePictureView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SUUsingViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="birthdayLabel">UILabel</string>
<string key="nameLabel">UILabel</string>
<string key="picView">FBProfilePictureView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="birthdayLabel">
<string key="name">birthdayLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="nameLabel">
<string key="name">nameLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="picView">
<string key="name">picView</string>
<string key="candidateClassName">FBProfilePictureView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/SUUsingViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1179</string>
</data>
</archive>
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
<string>Icon-72.png</string>
<string>Icon-72@2x.png</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
<string>Icon-72.png</string>
<string>Icon-72@2x.png</string>
</array>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>com.facebook.sdk.samples.switchuser</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb327842977278179</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>FacebookAppID</key>
<string>327842977278179</string>
<key>FacebookDisplayName</key>
<string>SwitchUserSample</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'SwitchUserSample' target in the 'SwitchUserSample' project
//
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */
Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

@@ -0,0 +1,26 @@
/*
* 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.
*/
#import <UIKit/UIKit.h>
#import "SUAppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([SUAppDelegate class]));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B