├── .gitignore ├── README.markdown ├── SCFacebook.podspec ├── SCFacebook ├── SCFacebook.h └── SCFacebook.m └── sample ├── Podfile ├── SCFacebook.xcodeproj └── project.pbxproj └── SCFacebook ├── Classes ├── AppDelegate.h ├── AppDelegate.m ├── FriendCell.h ├── FriendCell.m ├── FriendsViewControler.h ├── FriendsViewControler.m ├── HomeCell.h ├── HomeCell.m ├── HomeController.h └── HomeController.m ├── Images.xcassets ├── AppIcon.appiconset │ ├── Contents.json │ ├── icon.png │ ├── icon@2x.png │ └── icon@3x.png └── Contents.json ├── Resources └── videos │ └── SCFacebook.mov ├── SCFacebook-Info.plist ├── SCFacebook-Prefix.pch ├── en.lproj ├── InfoPlist.strings └── Main.storyboard └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | #Xcode 4 | 5 | build/* 6 | 7 | *.pbxuser 8 | 9 | !default.pbxuser 10 | 11 | *.mode1v3 12 | 13 | !default.mode1v3 14 | 15 | *.mode2v3 16 | 17 | !default.mode2v3 18 | 19 | *.perspectivev3 20 | 21 | !default.perspectivev3 22 | 23 | *.xcworkspace 24 | 25 | !default.xcworkspace 26 | 27 | xcuserdata* 28 | 29 | profile 30 | 31 | *.moved-aside 32 | 33 | Pods/ 34 | 35 | Podfile.lock 36 | 37 | SCFacebook.xcworkspace 38 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 |
2 | The SCFacebook 4.1 is a simple and cleaner to use the api [Facebook-ios-sdk] (https://github.com/facebook/facebook-ios-sdk) with Blocks. 3 | 4 | 5 | Facebook SDK 4.71 for iOS 6 | 7 | Graph API Version v2.12 8 | 9 | FBSDKCoreKit 10 | FBSDKShareKit 11 | FBSDKLoginKit 12 | 13 | 14 | Demo 15 | ================= 16 | 17 | ![SCFacebook Demo](http://www.lucascorrea.com/images/SCFacebookDemo.gif) 18 | 19 | Installation 20 | ================= 21 | 22 | Before you need to follow the guide to begin using Facebook SDK for iOS - 23 | [Getting Started with the Facebook iOS SDK](https://developers.facebook.com/docs/ios/getting-started) 24 | 25 | 26 | Getting Started 27 | ================= 28 | 29 | Using [CocoaPods](http://cocoapods.org) to get start, you can add following line to your Podfile: 30 | 31 | pod 'SCFacebook' 32 | 33 | Once you have set up the `URL Scheme` and `FacebookAppID` as image below: 34 | 35 | ![]( http://www.lucascorrea.com/images/FacebookAppID.png)) 36 | 37 | IOS 9 is required this add fields like the image below: 38 | 39 | ![]( http://www.lucascorrea.com/images/SCFacebookSettings.png) 40 | 41 | 42 | 43 | Now in it's `AppDelegate` need to add one method and add permissions 44 | 45 | #import 46 | 47 | @implementation AppDelegate 48 | 49 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 50 | 51 | /** 52 | Init SCFacebook 53 | Add the necessary permissions 54 | 55 | If your app asks for more than than public_profile and email, it will require review by Facebook before your app can be used by people other than the app's developers. 56 | 57 | The time to review your app is usually about 7 business days. Some extra-sensitive permissions, as noted below, can take up to 14 business days. 58 | 59 | https://developers.facebook.com/docs/facebook-login/permissions/review 60 | **/ 61 | 62 | [SCFacebook initWithReadPermissions:@[@"user_about_me", 63 | @"user_birthday", 64 | @"email", 65 | @"user_photos", 66 | @"user_events", 67 | @"user_friends", 68 | @"user_videos", 69 | @"public_profile"] 70 | publishPermissions:@[@"manage_pages", 71 | @"publish_actions", 72 | @"publish_pages"] 73 | ]; 74 | 75 | [FBSDKProfile enableUpdatesOnAccessTokenChange:YES]; 76 | return [[FBSDKApplicationDelegate sharedInstance] application:application 77 | didFinishLaunchingWithOptions:launchOptions]; 78 | } 79 | 80 | 81 | #pragma mark - 82 | #pragma mark - SCFacebook Handle 83 | 84 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 85 | return [[FBSDKApplicationDelegate sharedInstance] application:application 86 | openURL:url 87 | sourceApplication:sourceApplication 88 | annotation:annotation]; 89 | } 90 | 91 | Example Usage 92 | ============= 93 | 94 | To use the component is very easy. Import the header for your class. 95 | 96 | #import 97 | 98 | @implementation ViewController 99 | 100 | #pragma mark - Button Action 101 | - (IBAction)login:(id)sender { 102 | 103 | [SCFacebook loginCallBack:^(BOOL success, id result) { 104 | if (success) { 105 | } 106 | }]; 107 | } 108 | 109 | - (IBAction)publishYourWallLink:(id)sender { 110 | [SCFacebook feedPostWithLinkPath:@"http://www.lucascorrea.com" caption:@"Portfolio" callBack:^(BOOL success, id result) { 111 | if (success) { 112 | } 113 | }]; 114 | } 115 | 116 | - (IBAction)publishYourWallMessage:(id)sender { 117 | [SCFacebook feedPostWithMessage:@"This is message" callBack:^(BOOL success, id result) { 118 | if (success) { 119 | } 120 | }]; 121 | } 122 | 123 | 124 | Methods 125 | =========== 126 | 127 | 128 | When a person logs into your app via Facebook Login you can access a subset of that person's data stored on Facebook. Permissions are how you ask someone if you can access that data. A person's privacy settings combined with what you ask for will determine what you can access. 129 | Permissions are strings that are passed along with a login request or an API call. Here are two examples of permissions: 130 | email - Access to a person's primary email address. 131 | user_likes - Access to the list of things a person likes. 132 | https://developers.facebook.com/docs/facebook-login/permissions/v2.4 133 | @param permissions 134 | 135 | + (void)initWithReadPermissions:(NSArray *)readPermissions publishPermissions:(NSArray *)publishPermissions; 136 | 137 | 138 | Checks if there is an open session, if it is not checked if a token is created and returned there to validate session. 139 | @return BOOL 140 | 141 | + (BOOL)isSessionValid; 142 | 143 | 144 | Facebook login 145 | https://developers.facebook.com/docs/ios/graph 146 | @param callBack (BOOL success, id result) 147 | 148 | + (void)loginCallBack:(SCFacebookCallback)callBack; 149 | 150 | 151 | Facebook login 152 | https://developers.facebook.com/docs/ios/graph 153 | @param FBSDKLoginBehavior behavior 154 | @param callBack (BOOL success, id result) 155 | 156 | + (void)loginWithBehavior:(FBSDKLoginBehavior)behavior CallBack:(SCFacebookCallback)callBack; 157 | 158 | Facebook logout 159 | https://developers.facebook.com/docs/ios/graph 160 | @param callBack (BOOL success, id result) 161 | 162 | + (void)logoutCallBack:(SCFacebookCallback)callBack; 163 | 164 | 165 | Get the data from the logged in user by passing the fields. 166 | https://developers.facebook.com/docs/facebook-login/permissions/v2.12#reference-public_profile 167 | Permissions required: public_profile... 168 | @param callBack (BOOL success, id result) 169 | 170 | + (void)getUserFields:(NSString *)fields callBack:(SCFacebookCallback)callBack; 171 | 172 | 173 | This will only return any friends who have used (via Facebook Login) the app making the request. 174 | If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. 175 | 1 - get the User's friends who have installed the app making the query 176 | 2 - get the User's total number of friends (including those who have not installed the app making the query) 177 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ 178 | Permissions required: user_friends 179 | @param fields fields example: id, name, email, birthday, about, picture 180 | @param callBack (BOOL success, id result) 181 | 182 | + (void)getUserFriendsWithFields:(NSString *)fields callBack:(SCFacebookCallback)callBack; 183 | 184 | 185 | This will only return any friends who have used (via Facebook Login) the app making the request. 186 | If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. 187 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ 188 | Permissions required: user_friends 189 | @param callBack (BOOL success, id result) 190 | 191 | + (void)getUserFriendsCallBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("getUserFriendsCallBack has been replaced with getUserFriendsWithFields:callBack"))); 192 | 193 | 194 | Post in the user profile with link and caption 195 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 196 | Permissions required: publish_actions 197 | @param url NSString 198 | @param caption NSString 199 | @param callBack (BOOL success, id result) 200 | 201 | + (void)feedPostWithLinkPath:(NSString *)url caption:(NSString *)caption callBack:(SCFacebookCallback)callBack; 202 | 203 | 204 | Post in the user profile with message 205 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 206 | Permissions required: publish_actions 207 | @param message NSString 208 | @param callBack (BOOL success, id result) 209 | 210 | + (void)feedPostWithMessage:(NSString *)message callBack:(SCFacebookCallback)callBack; 211 | 212 | 213 | Post in the user profile with photo and caption 214 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 215 | Permissions required: publish_actions 216 | @param photo UIImage 217 | @param caption NSString 218 | @param callBack (BOOL success, id result) 219 | 220 | + (void)feedPostWithPhoto:(UIImage *)photo caption:(NSString *)caption callBack:(SCFacebookCallback)callBack; 221 | 222 | 223 | Post in the user profile with video, title and description 224 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 225 | Permissions required: publish_actions 226 | @param videoData NSData 227 | @param title NSString 228 | @param description NSString 229 | @param callBack (BOOL success, id result) 230 | 231 | + (void)feedPostWithVideo:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 232 | 233 | 234 | The feed of posts (including status updates) and links published by this person, or by others on this person's profile. 235 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 236 | Permissions required: read_stream 237 | @param callBack (BOOL success, id result) 238 | 239 | + (void)myFeedCallBack:(SCFacebookCallback)callBack; 240 | 241 | 242 | Invite friends with message via dialog 243 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/ 244 | @param appLink URL 245 | @param preview URL optional 246 | @param callBack (BOOL success, id result) 247 | 248 | + (void)inviteFriendsWithAppLinkURL:(NSURL *)url previewImageURL:(NSURL *)preview callBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("App Invites no longer supported"))); 249 | 250 | Get pages in user 251 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 252 | Permissions required: manage_pages 253 | @param callBack (BOOL success, id result) 254 | 255 | + (void)getPagesCallBack:(SCFacebookCallback)callBack; 256 | 257 | 258 | Get page with id 259 | Facebook Web address ou pageId 260 | Example http://www.lucascorrea.com/PageId.png 261 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 262 | Permissions required: manage_pages 263 | @param pageId Facebook Web address ou pageId 264 | @param callBack (BOOL success, id result) 265 | 266 | + (void)getPageById:(NSString *)pageId callBack:(SCFacebookCallback)callBack; 267 | 268 | 269 | Post in the page profile with message 270 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 271 | Permissions required: publish_actions 272 | @param page NSString 273 | @param message NSString 274 | @param callBack (BOOL success, id result) 275 | 276 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack; 277 | 278 | Post in the page profile with message and photo 279 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 280 | Permissions required: publish_actions 281 | @param page NSString 282 | @param message NSString 283 | @param photo UIImage 284 | @param callBack (BOOL success, id result) 285 | 286 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 287 | 288 | Post in the page profile with message and link 289 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 290 | Permissions required: publish_actions 291 | @param page NSString 292 | @param message NSString 293 | @param url NSString 294 | @param callBack (BOOL success, id result) 295 | 296 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack; 297 | 298 | Post in the page profile with video, title and description 299 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 300 | Permissions required: publish_actions 301 | @param page NSString 302 | @param videoData NSData 303 | @param title NSString 304 | @param description NSString 305 | @param callBack (BOOL success, id result) 306 | 307 | + (void)feedPostForPage:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 308 | 309 | Post on page with administrator profile with a message 310 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 311 | Permissions required: publish_actions 312 | @param page NSString 313 | @param message NSString 314 | @param callBack (BOOL success, id result) 315 | 316 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack; 317 | 318 | Post on page with administrator profile with a message and link 319 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 320 | Permissions required: publish_actions 321 | @param page NSString 322 | @param message NSString 323 | @param url NSString 324 | @param callBack (BOOL success, id result) 325 | 326 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack; 327 | 328 | Post on page with administrator profile with a message and photo 329 | Permissions required: publish_actions 330 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 331 | @param page NSString 332 | @param message NSString 333 | @param photo UIImage 334 | @param callBack (BOOL success, id result) 335 | 336 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 337 | 338 | Post on page with administrator profile with a video, title and description 339 | https://developers.facebook.com/docs/graph-api/reference/v2.12/page 340 | Permissions required: publish_actions 341 | @param page NSString 342 | @param videoData NSData 343 | @param title NSString 344 | @param description NSString 345 | @param callBack (BOOL success, id result) 346 | 347 | + (void)feedPostAdminForPageName:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 348 | 349 | Get albums in user 350 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 351 | Permissions required: user_photos 352 | @param callBack (BOOL success, id result) 353 | 354 | + (void)getAlbumsCallBack:(SCFacebookCallback)callBack; 355 | 356 | Get album with id 357 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 358 | Permissions required: user_photos 359 | @param albumId NSString 360 | @param callBack (BOOL success, id result) 361 | 362 | + (void)getAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack; 363 | 364 | Get photos the album with id 365 | https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 366 | Permissions required: user_photos 367 | @param albumId NSString 368 | @param params NSDictionary ex: @{@"fields": @"name, images"} 369 | @param callBack (BOOL success, id result) 370 | 371 | + (void)getPhotosAlbumById:(NSString *)albumId withParams:(NSDictionary*)params callBack:(SCFacebookCallback)callBack; 372 | 373 | Get photos the album with id 374 | https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 375 | Permissions required: user_photos 376 | @param albumId NSString 377 | @param callBack (BOOL success, id result) 378 | 379 | + (void)getPhotosAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("getPhotosAlbumById:callBack has been replaced with getPhotosAlbumById:withParams:callBack"))); 380 | 381 | Create album the user 382 | https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 383 | Permissions required: publish_actions and user_photos 384 | @param name NSString 385 | @param message NSString 386 | @param privacy ENUM 387 | @param callBack (BOOL success, id result) 388 | 389 | + (void)createAlbumName:(NSString *)name message:(NSString *)message privacy:(FBAlbumPrivacyType)privacy callBack:(SCFacebookCallback)callBack; 390 | 391 | Post the photo album in your user profile 392 | https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 393 | Permissions required: publish_actions 394 | @param albumId NSString 395 | @param photo UIImage 396 | @param callBack (BOOL success, id result) 397 | 398 | + (void)feedPostForAlbumId:(NSString *)albumId photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 399 | 400 | Post open graph 401 | Open Graph lets apps tell stories on Facebook through a structured, strongly typed API. When people engage with these stories they are directed to your app or, if they don't have your app installed, to your app's App Store page, driving engagement and distribution for your app. 402 | Stories have the following core components: 403 | An actor: the person who publishes the story, the user. 404 | An action the actor performs, for example: cook, run or read. 405 | An object on which the action is performed: cook a meal, run a race, read a book. 406 | An app: the app from which the story is posted, which is featured alongside the story. 407 | We provide some built in objects and actions for frequent use cases, and you can also create custom actions and objects to fit your app. 408 | https://developers.facebook.com/docs/ios/open-graph 409 | Permissions required: publish_actions 410 | @param actionType NSString 411 | @param graphObject NSString 412 | @param objectName NSString 413 | @param viewController UIViewController 414 | @param callBack (BOOL success, id result) 415 | 416 | + (void)sendForPostOpenGraphWithActionType:(NSString *)actionType graphObject:(FBSDKShareOpenGraphObject *)openGraphObject objectName:(NSString *)objectName viewController:(UIViewController *)viewController callBack:(SCFacebookCallback)callBack; 417 | 418 | If not on the list in SCFacebook method, this method can be used to make calls via the graph API GET 419 | Calling the Graph API GET 420 | https://developers.facebook.com/docs/ios/graph 421 | @param method NSString 422 | @param params NSDictionary 423 | @param callBack (BOOL success, id result) 424 | 425 | + (void)graphFacebookForMethodGET:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack; 426 | 427 | If not on the list in SCFacebook method, this method can be used to make calls via the graph API POST 428 | Calling the Graph API POST 429 | https://developers.facebook.com/docs/ios/graph 430 | @param method NSString 431 | @param params NSDictionary 432 | @param callBack (BOOL success, id result) 433 | 434 | + (void)graphFacebookForMethodPOST:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack; 435 | 436 | 437 | License 438 | ============= 439 | 440 | SCFacebook is licensed under the MIT License: 441 | 442 | Copyright (c) 2011-present Lucas Correa (http://www.lucascorrea.com/) 443 | 444 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 445 | 446 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 447 | 448 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 449 | -------------------------------------------------------------------------------- /SCFacebook.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint SCFacebook.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | 12 | s.name = "SCFacebook" 13 | s.version = "4.1" 14 | s.summary = "The SCFacebook is a simpler and cleaner to use the api facebook-ios-sdk Objective-C " 15 | 16 | s.description = <<-DESC 17 | The SCFacebook is a simpler and cleaner to use the api facebook-ios-sdk Objective-C (https://github.com/facebook/facebook-ios-sdk) to perform login, get friends list, information about the user and posting on the wall with ^Block for iPhone. 18 | http://www.lucascorrea.com 19 | DESC 20 | 21 | s.homepage = "http://www.lucascorrea.com" 22 | s.license = { :type => "MIT", :text => "SCFacebook is licensed under the MIT License" } 23 | 24 | s.author = { "Lucas Correa" => "contato@lucascorrea.com" } 25 | s.platform = :ios, "9.0" 26 | 27 | s.ios.deployment_target = "9.0" 28 | 29 | s.source = { :git => "https://github.com/lucascorrea/SCFacebook.git", :tag => "4.1" } 30 | 31 | s.source_files = "SCFacebook/**/*SCFacebook.{h,m}" 32 | 33 | s.requires_arc = true 34 | 35 | s.dependency "FBSDKCoreKit" 36 | s.dependency "FBSDKShareKit" 37 | s.dependency "FBSDKLoginKit" 38 | 39 | end 40 | -------------------------------------------------------------------------------- /SCFacebook/SCFacebook.h: -------------------------------------------------------------------------------- 1 | // 2 | // SCFacebook.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011-present Siriuscode Solutions. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | #import 28 | #import 29 | #import 30 | 31 | typedef void(^SCFacebookCallback)(BOOL success, id result); 32 | 33 | typedef NS_ENUM(NSInteger, FBPostType) { 34 | FBPostTypeStatus = 0, 35 | FBPostTypePhoto = 1, 36 | FBPostTypeLink = 2, 37 | FBPostTypeVideo = 3 38 | }; 39 | 40 | typedef NS_ENUM(NSInteger, FBAlbumPrivacyType) { 41 | FBAlbumPrivacyEveryone = 0, 42 | FBAlbumPrivacyAllFriends = 1, 43 | FBAlbumPrivacyFriendsOfFriends = 2, 44 | FBAlbumPrivacySelf = 3 45 | }; 46 | 47 | @interface SCFacebook : NSObject 48 | 49 | /** 50 | * 51 | * FacebookSDK version 52 | * 53 | * Version Schedules 54 | 55 | * Each version is guaranteed to operate for at least two years. A version will no longer be usable two years after the date that the subsequent version is released. 56 | 57 | * So if API version v2.3 is released on March 25th, 2015 and API version v2.4 is released August 7th, 2015 then v2.3 would expire on August 7th, 2017, two years after the release of v2.4. 58 | 59 | * https://developers.facebook.com/docs/apps/versions 60 | * 61 | */ 62 | @property (strong, nonatomic) FBSDKLoginManager *session; 63 | @property (strong, nonatomic) NSArray *readPermissions; 64 | @property (strong, nonatomic) NSArray *publishPermissions; 65 | @property (assign, nonatomic) FBPostType postType; 66 | 67 | 68 | /** 69 | * When a person logs into your app via Facebook Login you can access a subset of that person's data stored on Facebook. Permissions are how you ask someone if you can access that data. A person's privacy settings combined with what you ask for will determine what you can access. 70 | * 71 | * Permissions are strings that are passed along with a login request or an API call. Here are two examples of permissions: 72 | * 73 | * email - Access to a person's primary email address. 74 | * user_likes - Access to the list of things a person likes. 75 | * 76 | * https://developers.facebook.com/docs/facebook-login/permissions/v2.12 77 | * 78 | * @param readPermissions The permissons to use the Facebook SDK 79 | * @param publishPermissions The permissons to use the Facebook SDK 80 | */ 81 | + (void)initWithReadPermissions:(NSArray *)readPermissions publishPermissions:(NSArray *)publishPermissions; 82 | 83 | /** 84 | * Checks if there is an open session, if it is not checked if a token is created and returned there to validate session. 85 | * 86 | * @return BOOL 87 | */ 88 | + (BOOL)isSessionValid; 89 | 90 | /** 91 | * Facebook login 92 | * 93 | * https://developers.facebook.com/docs/ios/graph 94 | * 95 | * @param callBack (BOOL success, id result) 96 | */ 97 | + (void)loginCallBack:(SCFacebookCallback)callBack; 98 | 99 | 100 | /** 101 | * Facebook login 102 | * 103 | * https://developers.facebook.com/docs/ios/graph 104 | * @param behavior FBSDKLoginBehavior 105 | * @param callBack (BOOL success, id result) 106 | */ 107 | + (void)loginWithBehavior:(FBSDKLoginBehavior)behavior CallBack:(SCFacebookCallback)callBack; 108 | 109 | /** 110 | * Facebook logout 111 | * 112 | * https://developers.facebook.com/docs/ios/graph 113 | * 114 | * @param callBack (BOOL success, id result) 115 | */ 116 | + (void)logoutCallBack:(SCFacebookCallback)callBack; 117 | 118 | /** 119 | * Get the data from the logged in user by passing the fields. 120 | * 121 | * https://developers.facebook.com/docs/facebook-login/permissions/v2.12#reference-public_profile 122 | * 123 | * Permissions required: public_profile... 124 | * 125 | * @param callBack (BOOL success, id result) 126 | */ 127 | + (void)getUserFields:(NSString *)fields callBack:(SCFacebookCallback)callBack; 128 | 129 | /** 130 | * This will only return any friends who have used (via Facebook Login) the app making the request. 131 | * If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. 132 | 1 - get the User's friends who have installed the app making the query 133 | 2 - get the User's total number of friends (including those who have not installed the app making the query) 134 | * 135 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ 136 | * 137 | * Permissions required: user_friends 138 | * 139 | * @param fields fields example: id, name, email, birthday, about, picture 140 | * @param callBack (BOOL success, id result) 141 | */ 142 | + (void)getUserFriendsWithFields:(NSString *)fields callBack:(SCFacebookCallback)callBack; 143 | 144 | /** 145 | * This will only return any friends who have used (via Facebook Login) the app making the request. 146 | * If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person. 147 | * 148 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/friends/ 149 | * 150 | * Permissions required: user_friends 151 | * 152 | * @param callBack (BOOL success, id result) 153 | */ 154 | + (void)getUserFriendsCallBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("getUserFriendsCallBack has been replaced with getUserFriendsWithFields:callBack"))); 155 | 156 | /** 157 | * Post in the user profile with link and caption 158 | * 159 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 160 | * 161 | * Permissions required: publish_actions 162 | * 163 | * @param url NSString 164 | * @param caption NSString 165 | * @param callBack (BOOL success, id result) 166 | */ 167 | + (void)feedPostWithLinkPath:(NSString *)url caption:(NSString *)caption callBack:(SCFacebookCallback)callBack; 168 | 169 | /** 170 | * Post in the user profile with message 171 | * 172 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 173 | * 174 | * Permissions required: publish_actions 175 | * 176 | * @param message NSString 177 | * @param callBack (BOOL success, id result) 178 | */ 179 | + (void)feedPostWithMessage:(NSString *)message callBack:(SCFacebookCallback)callBack; 180 | 181 | /** 182 | * Post in the user profile with photo and caption 183 | * 184 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 185 | * 186 | * Permissions required: publish_actions 187 | * 188 | * @param photo UIImage 189 | * @param caption NSString 190 | * @param callBack (BOOL success, id result) 191 | */ 192 | + (void)feedPostWithPhoto:(UIImage *)photo caption:(NSString *)caption callBack:(SCFacebookCallback)callBack; 193 | 194 | /** 195 | * Post in the user profile with video, title and description 196 | * 197 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 198 | * 199 | * Permissions required: publish_actions 200 | * 201 | * @param videoData NSData 202 | * @param title NSString 203 | * @param description NSString 204 | * @param callBack (BOOL success, id result) 205 | */ 206 | + (void)feedPostWithVideo:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 207 | 208 | /** 209 | * The feed of posts (including status updates) and links published by this person, or by others on this person's profile. 210 | * 211 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/feed 212 | * 213 | * Permissions required: read_stream 214 | * 215 | * @param callBack (BOOL success, id result) 216 | */ 217 | + (void)myFeedCallBack:(SCFacebookCallback)callBack; 218 | 219 | /** 220 | * Invite friends with message via dialog 221 | * 222 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/ 223 | * 224 | * @param url URL 225 | * @param preview URL optional 226 | * @param callBack (BOOL success, id result) 227 | */ 228 | + (void)inviteFriendsWithAppLinkURL:(NSURL *)url previewImageURL:(NSURL *)preview callBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("App Invites no longer supported"))); 229 | 230 | /** 231 | * Get pages in user 232 | * 233 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 234 | * 235 | * Permissions required: manage_pages 236 | * 237 | * @param callBack (BOOL success, id result) 238 | */ 239 | + (void)getPagesCallBack:(SCFacebookCallback)callBack; 240 | 241 | /** 242 | * 243 | * Get page with id 244 | * 245 | * Facebook Web address ou pageId 246 | * Example http://www.lucascorrea.com/PageId.png 247 | * 248 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 249 | * 250 | * Permissions required: manage_pages 251 | * 252 | * @param pageId Facebook Web address ou pageId 253 | * @param callBack (BOOL success, id result) 254 | */ 255 | + (void)getPageById:(NSString *)pageId callBack:(SCFacebookCallback)callBack; 256 | 257 | /** 258 | * Post in the page profile with message 259 | * 260 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 261 | * 262 | * Permissions required: publish_actions 263 | * 264 | * @param page NSString 265 | * @param message NSString 266 | * @param callBack (BOOL success, id result) 267 | */ 268 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack; 269 | 270 | /** 271 | * Post in the page profile with message and photo 272 | * 273 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 274 | * 275 | * Permissions required: publish_actions 276 | * 277 | * @param page NSString 278 | * @param message NSString 279 | * @param photo UIImage 280 | * @param callBack (BOOL success, id result) 281 | */ 282 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 283 | 284 | /** 285 | * Post in the page profile with message and link 286 | * 287 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 288 | * 289 | * Permissions required: publish_actions 290 | * 291 | * @param page NSString 292 | * @param message NSString 293 | * @param url NSString 294 | * @param callBack (BOOL success, id result) 295 | */ 296 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack; 297 | 298 | /** 299 | * Post in the page profile with video, title and description 300 | * 301 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 302 | * 303 | * Permissions required: publish_actions 304 | * 305 | * @param page NSString 306 | * @param videoData NSData 307 | * @param title NSString 308 | * @param description NSString 309 | * @param callBack (BOOL success, id result) 310 | */ 311 | + (void)feedPostForPage:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 312 | 313 | /** 314 | * Post on page with administrator profile with a message 315 | * 316 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 317 | * 318 | * Permissions required: publish_actions 319 | * 320 | * @param page NSString 321 | * @param message NSString 322 | * @param callBack (BOOL success, id result) 323 | */ 324 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack; 325 | 326 | /** 327 | * Post on page with administrator profile with a message and link 328 | * 329 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 330 | * 331 | * Permissions required: publish_actions 332 | * 333 | * @param page NSString 334 | * @param message NSString 335 | * @param url NSString 336 | * @param callBack (BOOL success, id result) 337 | */ 338 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack; 339 | 340 | /** 341 | * Post on page with administrator profile with a message and photo 342 | * 343 | * Permissions required: publish_actions 344 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 345 | * 346 | * 347 | * @param page NSString 348 | * @param message NSString 349 | * @param photo UIImage 350 | * @param callBack (BOOL success, id result) 351 | */ 352 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 353 | 354 | /** 355 | * Post on page with administrator profile with a video, title and description 356 | * 357 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/page 358 | * 359 | * Permissions required: publish_actions 360 | * 361 | * @param page NSString 362 | * @param videoData NSData 363 | * @param title NSString 364 | * @param description NSString 365 | * @param callBack (BOOL success, id result) 366 | */ 367 | + (void)feedPostAdminForPageName:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack; 368 | 369 | /** 370 | * Get albums in user 371 | * 372 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 373 | * 374 | * Permissions required: user_photos 375 | * 376 | * @param callBack (BOOL success, id result) 377 | */ 378 | + (void)getAlbumsCallBack:(SCFacebookCallback)callBack; 379 | 380 | /** 381 | * Get album with id 382 | * 383 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 384 | * 385 | * Permissions required: user_photos 386 | * 387 | * @param albumId NSString 388 | * @param callBack (BOOL success, id result) 389 | */ 390 | + (void)getAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack; 391 | 392 | /** 393 | * Get photos the album with id 394 | * 395 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 396 | * 397 | * Permissions required: user_photos 398 | * 399 | * @param albumId NSString 400 | * @param params NSDictionary ex: @{@"fields": @"name, images"} 401 | * @param callBack (BOOL success, id result) 402 | */ 403 | + (void)getPhotosAlbumById:(NSString *)albumId withParams:(NSDictionary*)params callBack:(SCFacebookCallback)callBack; 404 | 405 | /** 406 | * Get photos the album with id 407 | * 408 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 409 | * 410 | * Permissions required: user_photos 411 | * 412 | * @param albumId NSString 413 | * @param callBack (BOOL success, id result) 414 | */ 415 | + (void)getPhotosAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack __attribute__ ((deprecated("getPhotosAlbumById:callBack has been replaced with getPhotosAlbumById:withParams:callBack"))); 416 | 417 | /** 418 | * Create album the user 419 | * 420 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/user/albums 421 | * 422 | * Permissions required: publish_actions and user_photos 423 | * 424 | * @param name NSString 425 | * @param message NSString 426 | * @param privacy ENUM 427 | * @param callBack (BOOL success, id result) 428 | */ 429 | + (void)createAlbumName:(NSString *)name message:(NSString *)message privacy:(FBAlbumPrivacyType)privacy callBack:(SCFacebookCallback)callBack; 430 | 431 | /** 432 | * Post the photo album in your user profile 433 | * 434 | * https://developers.facebook.com/docs/graph-api/reference/v2.12/album/photos 435 | * 436 | * Permissions required: publish_actions 437 | * 438 | * @param albumId NSString 439 | * @param photo UIImage 440 | * @param callBack (BOOL success, id result) 441 | */ 442 | + (void)feedPostForAlbumId:(NSString *)albumId photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack; 443 | 444 | /** 445 | * Post open graph 446 | * 447 | * Open Graph lets apps tell stories on Facebook through a structured, strongly typed API. When people engage with these stories they are directed to your app or, if they don't have your app installed, to your app's App Store page, driving engagement and distribution for your app. 448 | * 449 | * Stories have the following core components: 450 | * 451 | * An actor: the person who publishes the story, the user. 452 | * An action the actor performs, for example: cook, run or read. 453 | * An object on which the action is performed: cook a meal, run a race, read a book. 454 | * An app: the app from which the story is posted, which is featured alongside the story. 455 | * We provide some built in objects and actions for frequent use cases, and you can also create custom actions and objects to fit your app. 456 | * 457 | * https://developers.facebook.com/docs/ios/open-graph 458 | * 459 | * Permissions required: publish_actions 460 | * 461 | * @param actionType NSString 462 | * @param openGraphObject NSString 463 | * @param objectName NSString 464 | * @param viewController UIViewController 465 | * @param callBack (BOOL success, id result) 466 | */ 467 | + (void)sendForPostOpenGraphWithActionType:(NSString *)actionType graphObject:(FBSDKShareOpenGraphObject *)openGraphObject objectName:(NSString *)objectName viewController:(UIViewController *)viewController callBack:(SCFacebookCallback)callBack; 468 | 469 | /** 470 | * If not on the list in SCFacebook method, this method can be used to make calls via the graph API GET 471 | * 472 | * Calling the Graph API GET 473 | * 474 | * https://developers.facebook.com/docs/ios/graph 475 | * 476 | * @param method NSString 477 | * @param params NSDictionary 478 | * @param callBack (BOOL success, id result) 479 | */ 480 | + (void)graphFacebookForMethodGET:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack; 481 | 482 | /** 483 | * If not on the list in SCFacebook method, this method can be used to make calls via the graph API POST 484 | * 485 | * Calling the Graph API POST 486 | * 487 | * https://developers.facebook.com/docs/ios/graph 488 | * 489 | * @param method NSString 490 | * @param params NSDictionary 491 | * @param callBack (BOOL success, id result) 492 | */ 493 | + (void)graphFacebookForMethodPOST:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack; 494 | 495 | @end 496 | -------------------------------------------------------------------------------- /SCFacebook/SCFacebook.m: -------------------------------------------------------------------------------- 1 | // 2 | // SCFacebook.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011-present Siriuscode Solutions. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "SCFacebook.h" 27 | 28 | @interface SCFacebook() 29 | 30 | @property (strong, nonatomic) FBSDKLoginManager *loginManager; 31 | @property (strong, nonatomic) SCFacebookCallback inviteCallcack; 32 | @property (strong, nonatomic) SCFacebookCallback sharedCallcack; 33 | 34 | @end 35 | 36 | @implementation SCFacebook 37 | 38 | 39 | #pragma mark - 40 | #pragma mark - Private Methods 41 | 42 | - (void)initWithReadPermissions:(NSArray *)readPermissions publishPermissions:(NSArray *)publishPermissions { 43 | self.readPermissions = readPermissions; 44 | self.publishPermissions = publishPermissions; 45 | } 46 | 47 | - (BOOL)isSessionValid { 48 | return [FBSDKAccessToken currentAccessToken] != nil; 49 | } 50 | 51 | - (void)loginCallBack:(SCFacebookCallback)callBack { 52 | [self loginWithBehavior:FBSDKLoginBehaviorSystemAccount CallBack:callBack]; 53 | } 54 | 55 | - (void)loginWithBehavior:(FBSDKLoginBehavior)behavior CallBack:(SCFacebookCallback)callBack { 56 | if (behavior) { 57 | self.loginManager.loginBehavior = behavior; 58 | } 59 | 60 | [self.loginManager logInWithReadPermissions: self.readPermissions 61 | fromViewController: nil 62 | handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 63 | if (error) { 64 | callBack(NO, error.localizedDescription); 65 | } else if (result.isCancelled) { 66 | callBack(NO, @"Cancelled"); 67 | } else { 68 | if(callBack){ 69 | callBack(!error, result); 70 | } 71 | } 72 | }]; 73 | } 74 | 75 | 76 | - (void)logoutCallBack:(SCFacebookCallback)callBack { 77 | [self.loginManager logOut]; 78 | 79 | NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage]; 80 | NSArray* facebookCookies = [cookies cookiesForURL:[NSURL URLWithString:@"https://facebook.com/"]]; 81 | 82 | for (NSHTTPCookie* cookie in facebookCookies) { 83 | [cookies deleteCookie:cookie]; 84 | } 85 | 86 | callBack(YES, @"Logout successfully"); 87 | } 88 | 89 | - (void)getUserFields:(NSString *)fields callBack:(SCFacebookCallback)callBack { 90 | if (![self isSessionValid]) { 91 | callBack(NO, @"Not logged in"); 92 | return; 93 | } 94 | 95 | [self graphFacebookForMethodGET:@"me" params:@{@"fields" : fields} callBack:callBack]; 96 | } 97 | 98 | 99 | - (void)getUserFriendsWithFields:(NSString *)fields callBack:(SCFacebookCallback)callBack { 100 | if (![self isSessionValid]) { 101 | callBack(NO, @"Not logged in"); 102 | return; 103 | } 104 | 105 | if ([[FBSDKAccessToken currentAccessToken] hasGranted:(@"user_friends")]) { 106 | [self graphFacebookForMethodGET:@"me/friends" params:@{@"fields" : fields} callBack:callBack]; 107 | } else { 108 | 109 | self.loginManager.loginBehavior = FBSDKLoginBehaviorSystemAccount; 110 | [self.loginManager logInWithPublishPermissions:self.publishPermissions fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 111 | if (error) { 112 | callBack(NO, error.localizedDescription); 113 | } else if (result.isCancelled) { 114 | callBack(NO, @"Cancelled"); 115 | } else { 116 | [self graphFacebookForMethodGET:@"me/friends" params:@{@"fields" : fields} callBack:callBack]; 117 | } 118 | }]; 119 | } 120 | } 121 | 122 | - (void)feedPostWithLinkPath:(NSString *)url caption:(NSString *)caption message:(NSString *)message photo:(UIImage *)photo video:(NSData *)videoData callBack:(SCFacebookCallback)callBack { 123 | if (![self isSessionValid]) { 124 | callBack(NO, @"Not logged in"); 125 | return; 126 | } 127 | 128 | NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; 129 | //Need to provide POST parameters to the Facebook SDK for the specific post type 130 | NSString *graphPath = @"me/feed"; 131 | 132 | switch (self.postType) { 133 | case FBPostTypeLink:{ 134 | [params setObject:(url != nil) ? url : @"" forKey:@"link"]; 135 | [params setObject:(caption != nil) ? caption : @"" forKey:@"description"]; 136 | break; 137 | } 138 | case FBPostTypeStatus:{ 139 | [params setObject:(message != nil) ? message : @"" forKey:@"message"]; 140 | break; 141 | } 142 | case FBPostTypePhoto:{ 143 | graphPath = @"me/photos"; 144 | [params setObject:UIImagePNGRepresentation(photo) forKey:@"source"]; 145 | [params setObject:(caption != nil) ? caption : @"" forKey:@"message"]; 146 | break; 147 | } 148 | case FBPostTypeVideo:{ 149 | graphPath = @"me/videos"; 150 | 151 | if (videoData == nil) { 152 | callBack(NO, @"Not logged in"); 153 | return; 154 | } 155 | 156 | [params setObject:videoData forKey:@"video.mp4"]; 157 | [params setObject:caption forKey:@"title"]; 158 | [params setObject:message forKey:@"description"]; 159 | break; 160 | } 161 | 162 | default: 163 | break; 164 | } 165 | 166 | [self graphFacebookForMethodPOST:graphPath params:params callBack:callBack]; 167 | } 168 | 169 | - (void)myFeedCallBack:(SCFacebookCallback)callBack { 170 | if (![self isSessionValid]) { 171 | callBack(NO, @"Not logged in"); 172 | return; 173 | } 174 | 175 | [self graphFacebookForMethodPOST:@"me/feed" params:nil callBack:callBack]; 176 | } 177 | 178 | - (void)inviteFriendsWithAppLinkURL:(NSURL *)url previewImageURL:(NSURL *)preview callBack:(SCFacebookCallback)callBack { 179 | if (![self isSessionValid]) { 180 | callBack(NO, @"Not logged in"); 181 | return; 182 | } 183 | 184 | FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init]; 185 | content.appLinkURL = url; 186 | 187 | if (preview) { 188 | //optionally set previewImageURL 189 | content.appInvitePreviewImageURL = preview; 190 | } 191 | 192 | #pragma clang diagnostic push 193 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 194 | 195 | [FBSDKAppInviteDialog showFromViewController:nil withContent:content 196 | delegate:self]; 197 | #pragma clang diagnostic pop 198 | self.inviteCallcack = callBack; 199 | } 200 | 201 | - (void)getPagesCallBack:(SCFacebookCallback)callBack { 202 | if (![self isSessionValid]) { 203 | callBack(NO, @"Not logged in"); 204 | return; 205 | } 206 | 207 | if ([[FBSDKAccessToken currentAccessToken] hasGranted:(@"manage_pages")]) { 208 | [self graphFacebookForMethodGET:@"me/accounts" params:nil callBack:callBack]; 209 | } else { 210 | 211 | self.loginManager.loginBehavior = FBSDKLoginBehaviorSystemAccount; 212 | [self.loginManager logInWithPublishPermissions:self.publishPermissions fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 213 | if (error) { 214 | callBack(NO, error.localizedDescription); 215 | } else if (result.isCancelled) { 216 | callBack(NO, @"Cancelled"); 217 | } else { 218 | [self graphFacebookForMethodGET:@"me/accounts" params:nil callBack:callBack]; 219 | } 220 | }]; 221 | } 222 | 223 | } 224 | 225 | - (void)getPageById:(NSString *)pageId callBack:(SCFacebookCallback)callBack { 226 | if (![self isSessionValid]) { 227 | callBack(NO, @"Not logged in"); 228 | return; 229 | } 230 | 231 | if (!pageId) { 232 | callBack(NO, @"Page id or name required"); 233 | return; 234 | } 235 | 236 | [SCFacebook graphFacebookForMethodGET:pageId params:nil callBack:callBack]; 237 | } 238 | 239 | - (void)feedPostForPage:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack { 240 | if (![self isSessionValid]) { 241 | callBack(NO, @"Not logged in"); 242 | return; 243 | } 244 | 245 | if (!page) { 246 | callBack(NO, @"Page id or name required"); 247 | return; 248 | } 249 | 250 | [SCFacebook graphFacebookForMethodPOST:[NSString stringWithFormat:@"%@/feed", page] params:@{@"message": message} callBack:callBack]; 251 | } 252 | 253 | - (void)feedPostForPage:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 254 | 255 | if (![self isSessionValid]) { 256 | callBack(NO, @"Not logged in"); 257 | return; 258 | } 259 | 260 | if (!page) { 261 | callBack(NO, @"Page id or name required"); 262 | return; 263 | } 264 | 265 | [SCFacebook graphFacebookForMethodPOST:[NSString stringWithFormat:@"%@/photos", page] params:@{@"message": message, @"source" : UIImagePNGRepresentation(photo)} callBack:callBack]; 266 | } 267 | 268 | - (void)feedPostForPage:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack { 269 | if (![self isSessionValid]) { 270 | callBack(NO, @"Not logged in"); 271 | return; 272 | } 273 | 274 | if (!page) { 275 | callBack(NO, @"Page id or name required"); 276 | return; 277 | } 278 | 279 | [SCFacebook graphFacebookForMethodPOST:[NSString stringWithFormat:@"%@/feed", page] params:@{@"message": message, @"link" : url} callBack:callBack]; 280 | } 281 | 282 | - (void)feedPostForPage:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack { 283 | if (![self isSessionValid]) { 284 | callBack(NO, @"Not logged in"); 285 | return; 286 | } 287 | 288 | if (!page) { 289 | callBack(NO, @"Page id or name required"); 290 | return; 291 | } 292 | 293 | [SCFacebook graphFacebookForMethodPOST:[NSString stringWithFormat:@"%@/videos", page] 294 | params:@{@"title" : title, 295 | @"description" : description, 296 | @"video.mp4" : videoData} callBack:callBack]; 297 | } 298 | 299 | - (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack { 300 | 301 | if (![self isSessionValid]) { 302 | callBack(NO, @"Not logged in"); 303 | return; 304 | } 305 | 306 | [SCFacebook getPagesCallBack:^(BOOL success, id result) { 307 | 308 | if (success) { 309 | 310 | NSDictionary *dicPageAdmin = nil; 311 | 312 | for (NSDictionary *dic in result[@"data"]) { 313 | 314 | if ([dic[@"name"] isEqualToString:page]) { 315 | dicPageAdmin = dic; 316 | break; 317 | } 318 | } 319 | 320 | if (!dicPageAdmin) { 321 | callBack(NO, @"Page not found!"); 322 | return; 323 | } 324 | 325 | 326 | 327 | FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 328 | initWithGraphPath:[NSString stringWithFormat:@"%@/feed",dicPageAdmin[@"id"]] parameters:@{@"message" : message} HTTPMethod:@"POST"]; 329 | 330 | [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 331 | if (error) { 332 | callBack(NO, [error domain]); 333 | }else{ 334 | callBack(YES, result); 335 | } 336 | }]; 337 | } 338 | }]; 339 | } 340 | 341 | - (void)feedPostAdminForPageName:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack { 342 | 343 | if (![self isSessionValid]) { 344 | callBack(NO, @"Not logged in"); 345 | return; 346 | } 347 | 348 | [SCFacebook getPagesCallBack:^(BOOL success, id result) { 349 | 350 | if (success) { 351 | 352 | NSDictionary *dicPageAdmin = nil; 353 | 354 | for (NSDictionary *dic in result[@"data"]) { 355 | 356 | if ([dic[@"name"] isEqualToString:page]) { 357 | dicPageAdmin = dic; 358 | break; 359 | } 360 | } 361 | 362 | if (!dicPageAdmin) { 363 | callBack(NO, @"Page not found!"); 364 | return; 365 | } 366 | 367 | 368 | FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 369 | initWithGraphPath:[NSString stringWithFormat:@"%@/feed", dicPageAdmin[@"id"]] 370 | parameters:@{ 371 | @"title" : title, 372 | @"description" : description, 373 | @"video.mp4" : videoData, 374 | @"access_token" : dicPageAdmin[@"access_token"] 375 | } 376 | HTTPMethod:@"POST"]; 377 | 378 | [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 379 | if (error) { 380 | callBack(NO, [error domain]); 381 | }else{ 382 | callBack(YES, result); 383 | } 384 | }]; 385 | } 386 | }]; 387 | } 388 | 389 | - (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack { 390 | if (![self isSessionValid]) { 391 | callBack(NO, @"Not logged in"); 392 | return; 393 | } 394 | 395 | [SCFacebook getPagesCallBack:^(BOOL success, id result) { 396 | 397 | if (success) { 398 | 399 | NSDictionary *dicPageAdmin = nil; 400 | 401 | for (NSDictionary *dic in result[@"data"]) { 402 | 403 | if ([dic[@"name"] isEqualToString:page]) { 404 | dicPageAdmin = dic; 405 | break; 406 | } 407 | } 408 | 409 | if (!dicPageAdmin) { 410 | callBack(NO, @"Page not found!"); 411 | return; 412 | } 413 | 414 | FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 415 | initWithGraphPath:[NSString stringWithFormat:@"%@/feed", dicPageAdmin[@"id"]] 416 | parameters:@{ 417 | @"message" : message, 418 | @"link" : url, 419 | @"access_token" : dicPageAdmin[@"access_token"] 420 | } 421 | HTTPMethod:@"POST"]; 422 | 423 | [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 424 | if (error) { 425 | callBack(NO, [error domain]); 426 | }else{ 427 | callBack(YES, result); 428 | } 429 | }]; 430 | } 431 | }]; 432 | } 433 | 434 | - (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 435 | 436 | if (![self isSessionValid]) { 437 | callBack(NO, @"Not logged in"); 438 | return; 439 | } 440 | 441 | [SCFacebook getPagesCallBack:^(BOOL success, id result) { 442 | 443 | if (success) { 444 | 445 | NSDictionary *dicPageAdmin = nil; 446 | 447 | for (NSDictionary *dic in result[@"data"]) { 448 | 449 | if ([dic[@"name"] isEqualToString:page]) { 450 | dicPageAdmin = dic; 451 | break; 452 | } 453 | } 454 | 455 | if (!dicPageAdmin) { 456 | callBack(NO, @"Page not found!"); 457 | return; 458 | } 459 | 460 | 461 | FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 462 | initWithGraphPath:[NSString stringWithFormat:@"%@/feed", dicPageAdmin[@"id"]] 463 | parameters:@{ 464 | @"message" : message, 465 | @"source" : UIImagePNGRepresentation(photo), 466 | @"access_token" : dicPageAdmin[@"access_token"] } 467 | HTTPMethod:@"POST"]; 468 | 469 | [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 470 | if (error) { 471 | callBack(NO, [error domain]); 472 | }else{ 473 | callBack(YES, result); 474 | } 475 | }]; 476 | } 477 | }]; 478 | } 479 | 480 | - (void)getAlbumsCallBack:(SCFacebookCallback)callBack { 481 | if (![self isSessionValid]) { 482 | callBack(NO, @"Not logged in"); 483 | return; 484 | } 485 | 486 | [self graphFacebookForMethodGET:@"me/albums" params:nil callBack:callBack]; 487 | } 488 | 489 | - (void)getAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack { 490 | if (![self isSessionValid]) { 491 | callBack(NO, @"Not logged in"); 492 | return; 493 | } 494 | 495 | if (!albumId) { 496 | callBack(NO, @"Album id required"); 497 | return; 498 | } 499 | 500 | [SCFacebook graphFacebookForMethodGET:albumId params:nil callBack:callBack]; 501 | } 502 | 503 | - (void)getPhotosAlbumById:(NSString *)albumId withParams:(NSDictionary*)params callBack:(SCFacebookCallback)callBack { 504 | if (![self isSessionValid]) { 505 | callBack(NO, @"Not logged in"); 506 | return; 507 | } 508 | 509 | if (!albumId) { 510 | callBack(NO, @"Album id required"); 511 | return; 512 | } 513 | 514 | [SCFacebook graphFacebookForMethodGET:[NSString stringWithFormat:@"%@/photos", albumId] params:params callBack:callBack]; 515 | } 516 | 517 | - (void)createAlbumName:(NSString *)name message:(NSString *)message privacy:(FBAlbumPrivacyType)privacy callBack:(SCFacebookCallback)callBack { 518 | if (![self isSessionValid]) { 519 | callBack(NO, @"Not logged in"); 520 | return; 521 | } 522 | 523 | if (!name && !message) { 524 | callBack(NO, @"Name and message required"); 525 | return; 526 | } 527 | 528 | NSString *privacyString = @""; 529 | 530 | switch (privacy) { 531 | case FBAlbumPrivacyEveryone: 532 | privacyString = @"EVERYONE"; 533 | break; 534 | case FBAlbumPrivacyAllFriends: 535 | privacyString = @"ALL_FRIENDS"; 536 | break; 537 | case FBAlbumPrivacyFriendsOfFriends: 538 | privacyString = @"FRIENDS_OF_FRIENDS"; 539 | break; 540 | case FBAlbumPrivacySelf: 541 | privacyString = @"SELF"; 542 | break; 543 | default: 544 | break; 545 | } 546 | 547 | [SCFacebook graphFacebookForMethodPOST:@"me/albums" params:@{@"name" : (name != nil) ? name : @"", 548 | @"message" : message, 549 | @"value" : privacyString} callBack:callBack]; 550 | } 551 | 552 | - (void)feedPostForAlbumId:(NSString *)albumId photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 553 | if (![self isSessionValid]) { 554 | callBack(NO, @"Not logged in"); 555 | return; 556 | } 557 | 558 | if (!albumId) { 559 | callBack(NO, @"Album id required"); 560 | return; 561 | } 562 | 563 | [SCFacebook graphFacebookForMethodPOST:[NSString stringWithFormat:@"%@/photos", albumId] params:@{@"source": UIImagePNGRepresentation(photo)} callBack:callBack]; 564 | } 565 | 566 | - (void)sendForPostOpenGraphWithActionType:(NSString *)actionType graphObject:(FBSDKShareOpenGraphObject *)openGraphObject objectName:(NSString *)objectName viewController:(UIViewController *)viewController callBack:(SCFacebookCallback)callBack { 567 | if (![self isSessionValid]) { 568 | callBack(NO, @"Not logged in"); 569 | return; 570 | } 571 | 572 | FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init]; 573 | action.actionType = actionType; 574 | [action setObject:openGraphObject forKey:objectName]; 575 | FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init]; 576 | content.action = action; 577 | content.previewPropertyName = objectName; 578 | 579 | [FBSDKShareDialog showFromViewController:viewController 580 | withContent:content 581 | delegate:self]; 582 | 583 | self.sharedCallcack = callBack; 584 | } 585 | 586 | - (void)graphFacebookForMethodPOST:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack { 587 | [self graphFacebookForMethod:method httpMethod:@"POST" params:params callBack:callBack]; 588 | } 589 | 590 | - (void)graphFacebookForMethodGET:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack { 591 | [self graphFacebookForMethod:method httpMethod:@"GET" params:params callBack:callBack]; 592 | } 593 | 594 | - (void)graphFacebookForMethod:(NSString *)method httpMethod:(NSString *)httpMethod params:(id)params callBack:(SCFacebookCallback)callBack { 595 | [[[FBSDKGraphRequest alloc] initWithGraphPath:method 596 | parameters:params 597 | HTTPMethod:httpMethod] 598 | startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 599 | if ([error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] isEqual:@200]) { 600 | callBack(NO, error); 601 | } else { 602 | callBack(YES, result); 603 | } 604 | }]; 605 | } 606 | 607 | 608 | 609 | #pragma mark - 610 | #pragma mark - FBSDKAppInviteDialogDelegate methods 611 | 612 | - (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results { 613 | self.inviteCallcack(YES, results); 614 | self.inviteCallcack = nil; 615 | } 616 | 617 | - (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error { 618 | self.inviteCallcack(NO, error); 619 | self.inviteCallcack = nil; 620 | } 621 | 622 | 623 | 624 | #pragma mark - 625 | #pragma mark - FBSDKSharingDelegate methods 626 | 627 | - (void)sharer:(id)sharer didCompleteWithResults:(NSDictionary *)results { 628 | self.sharedCallcack(YES, results); 629 | self.sharedCallcack = nil; 630 | } 631 | 632 | - (void)sharer:(id)sharer didFailWithError:(NSError *)error { 633 | self.sharedCallcack(NO, error); 634 | self.sharedCallcack = nil; 635 | } 636 | 637 | - (void)sharerDidCancel:(id)sharer { 638 | self.sharedCallcack(YES, @"Cancelled"); 639 | self.sharedCallcack = nil; 640 | } 641 | 642 | 643 | 644 | 645 | 646 | #pragma mark - 647 | #pragma mark - Singleton 648 | 649 | + (SCFacebook *)shared { 650 | static SCFacebook *scFacebook = nil; 651 | 652 | @synchronized (self){ 653 | 654 | static dispatch_once_t pred; 655 | dispatch_once(&pred, ^{ 656 | scFacebook = [[SCFacebook alloc] init]; 657 | scFacebook.loginManager = [[FBSDKLoginManager alloc] init]; 658 | }); 659 | } 660 | 661 | return scFacebook; 662 | } 663 | 664 | 665 | 666 | #pragma mark - 667 | #pragma mark - Public Methods 668 | 669 | + (void)initWithReadPermissions:(NSArray *)readPermissions publishPermissions:(NSArray *)publishPermissions { 670 | [[SCFacebook shared] initWithReadPermissions:readPermissions publishPermissions:publishPermissions]; 671 | } 672 | 673 | +(BOOL)isSessionValid { 674 | return [[SCFacebook shared] isSessionValid]; 675 | } 676 | 677 | + (void)loginCallBack:(SCFacebookCallback)callBack { 678 | [[SCFacebook shared] loginCallBack:callBack]; 679 | } 680 | 681 | + (void)loginWithBehavior:(FBSDKLoginBehavior)behavior CallBack:(SCFacebookCallback)callBack { 682 | [[SCFacebook shared] loginWithBehavior:behavior CallBack:callBack]; 683 | } 684 | 685 | + (void)logoutCallBack:(SCFacebookCallback)callBack { 686 | [[SCFacebook shared] logoutCallBack:callBack]; 687 | } 688 | 689 | + (void)getUserFields:(NSString *)fields callBack:(SCFacebookCallback)callBack { 690 | [[SCFacebook shared] getUserFields:fields callBack:callBack]; 691 | } 692 | 693 | + (void)getUserFriendsWithFields:(NSString *)fields callBack:(SCFacebookCallback)callBack { 694 | [[SCFacebook shared] getUserFriendsWithFields:fields callBack:callBack]; 695 | } 696 | 697 | + (void)getUserFriendsCallBack:(SCFacebookCallback)callBack { 698 | 699 | } 700 | 701 | + (void)feedPostWithLinkPath:(NSString *)url caption:(NSString *)caption callBack:(SCFacebookCallback)callBack { 702 | [SCFacebook shared].postType = FBPostTypeLink; 703 | [[SCFacebook shared] feedPostWithLinkPath:url caption:caption message:nil photo:nil video:nil callBack:callBack]; 704 | } 705 | 706 | + (void)feedPostWithMessage:(NSString *)message callBack:(SCFacebookCallback)callBack { 707 | [SCFacebook shared].postType = FBPostTypeStatus; 708 | [[SCFacebook shared] feedPostWithLinkPath:nil caption:nil message:message photo:nil video:nil callBack:callBack]; 709 | } 710 | 711 | + (void)feedPostWithPhoto:(UIImage *)photo caption:(NSString *)caption callBack:(SCFacebookCallback)callBack { 712 | [SCFacebook shared].postType = FBPostTypePhoto; 713 | [[SCFacebook shared] feedPostWithLinkPath:nil caption:caption message:nil photo:photo video:nil callBack:callBack]; 714 | } 715 | 716 | + (void)feedPostWithVideo:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack { 717 | [SCFacebook shared].postType = FBPostTypeVideo; 718 | [[SCFacebook shared] feedPostWithLinkPath:nil caption:title message:description photo:nil video:videoData callBack:callBack]; 719 | } 720 | 721 | + (void)myFeedCallBack:(SCFacebookCallback)callBack { 722 | [[SCFacebook shared] myFeedCallBack:callBack]; 723 | } 724 | 725 | + (void)inviteFriendsWithAppLinkURL:(NSURL *)url previewImageURL:(NSURL *)preview callBack:(SCFacebookCallback)callBack { 726 | [[SCFacebook shared] inviteFriendsWithAppLinkURL:url previewImageURL:preview callBack:callBack]; 727 | } 728 | 729 | + (void)getPagesCallBack:(SCFacebookCallback)callBack { 730 | [[SCFacebook shared] getPagesCallBack:callBack]; 731 | } 732 | 733 | + (void)getPageById:(NSString *)pageId callBack:(SCFacebookCallback)callBack { 734 | [[SCFacebook shared] getPageById:pageId callBack:callBack]; 735 | } 736 | 737 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack { 738 | [[SCFacebook shared] feedPostForPage:page message:message callBack:callBack]; 739 | } 740 | 741 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 742 | [[SCFacebook shared] feedPostForPage:page message:message photo:photo callBack:callBack]; 743 | } 744 | 745 | + (void)feedPostForPage:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack { 746 | [[SCFacebook shared] feedPostForPage:page message:message link:url callBack:callBack]; 747 | } 748 | 749 | + (void)feedPostForPage:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack { 750 | [[SCFacebook shared] feedPostForPage:page video:videoData title:title description:description callBack:callBack]; 751 | } 752 | 753 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message callBack:(SCFacebookCallback)callBack { 754 | [[SCFacebook shared] feedPostAdminForPageName:page message:message callBack:callBack]; 755 | } 756 | 757 | + (void)feedPostAdminForPageName:(NSString *)page video:(NSData *)videoData title:(NSString *)title description:(NSString *)description callBack:(SCFacebookCallback)callBack { 758 | [[SCFacebook shared] feedPostAdminForPageName:page video:videoData title:title description:description callBack:callBack]; 759 | } 760 | 761 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message link:(NSString *)url callBack:(SCFacebookCallback)callBack { 762 | [[SCFacebook shared] feedPostAdminForPageName:page message:message link:url callBack:callBack]; 763 | } 764 | 765 | + (void)feedPostAdminForPageName:(NSString *)page message:(NSString *)message photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 766 | [[SCFacebook shared] feedPostAdminForPageName:page message:message photo:photo callBack:callBack]; 767 | } 768 | 769 | + (void)getAlbumsCallBack:(SCFacebookCallback)callBack { 770 | [[SCFacebook shared] getAlbumsCallBack:callBack]; 771 | } 772 | 773 | + (void)getAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack { 774 | [[SCFacebook shared] getAlbumById:albumId callBack:callBack]; 775 | } 776 | 777 | + (void)getPhotosAlbumById:(NSString *)albumId callBack:(SCFacebookCallback)callBack { 778 | 779 | } 780 | 781 | + (void)getPhotosAlbumById:(NSString *)albumId withParams:(NSDictionary*)params callBack:(SCFacebookCallback)callBack { 782 | [[SCFacebook shared] getPhotosAlbumById:albumId withParams:params callBack:callBack]; 783 | } 784 | 785 | + (void)createAlbumName:(NSString *)name message:(NSString *)message privacy:(FBAlbumPrivacyType)privacy callBack:(SCFacebookCallback)callBack { 786 | [[SCFacebook shared] createAlbumName:name message:message privacy:privacy callBack:callBack]; 787 | } 788 | 789 | + (void)feedPostForAlbumId:(NSString *)albumId photo:(UIImage *)photo callBack:(SCFacebookCallback)callBack { 790 | [[SCFacebook shared] feedPostForAlbumId:albumId photo:photo callBack:callBack]; 791 | } 792 | 793 | + (void)sendForPostOpenGraphWithActionType:(NSString *)actionType graphObject:(FBSDKShareOpenGraphObject *)openGraphObject objectName:(NSString *)objectName viewController:(UIViewController *)viewController callBack:(SCFacebookCallback)callBack { 794 | [[SCFacebook shared] sendForPostOpenGraphWithActionType:actionType graphObject:openGraphObject objectName:objectName viewController:(UIViewController *)viewController callBack:callBack]; 795 | } 796 | 797 | + (void)graphFacebookForMethodGET:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack { 798 | [[SCFacebook shared] graphFacebookForMethodGET:method params:params callBack:callBack]; 799 | } 800 | 801 | + (void)graphFacebookForMethodPOST:(NSString *)method params:(id)params callBack:(SCFacebookCallback)callBack { 802 | [[SCFacebook shared] graphFacebookForMethodPOST:method params:params callBack:callBack]; 803 | } 804 | 805 | 806 | @end 807 | -------------------------------------------------------------------------------- /sample/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, "9.0" 3 | 4 | use_frameworks! 5 | 6 | target "SCFacebook" do 7 | pod 'SDWebImage' 8 | pod 'FBSDKCoreKit' 9 | pod 'FBSDKShareKit' 10 | pod 'FBSDKLoginKit' 11 | end 12 | 13 | -------------------------------------------------------------------------------- /sample/SCFacebook.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 34997647CCBB043F71CE131C /* Pods_SCFacebook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F83321DEBF3E783A1E8E4E /* Pods_SCFacebook.framework */; }; 11 | 4DF43AC7147EBFB500A7D104 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DF43AC6147EBFB500A7D104 /* QuartzCore.framework */; }; 12 | A006C4771BB1B44500F8F728 /* SCFacebook.m in Sources */ = {isa = PBXBuildFile; fileRef = A006C4751BB1B44500F8F728 /* SCFacebook.m */; }; 13 | A006F5841BB198290024416F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A006F5821BB198290024416F /* AppDelegate.m */; }; 14 | A0A59A83206BE7EA0099885C /* README.markdown in Resources */ = {isa = PBXBuildFile; fileRef = A0A59A82206BE7EA0099885C /* README.markdown */; }; 15 | A0C801E219C3BAE50045D60E /* SCFacebook.mov in Resources */ = {isa = PBXBuildFile; fileRef = A0C801DD19C3BAE50045D60E /* SCFacebook.mov */; }; 16 | F91989D115143C9700A39D1E /* HomeController.m in Sources */ = {isa = PBXBuildFile; fileRef = F91989D015143C9700A39D1E /* HomeController.m */; }; 17 | F91989D815143CAC00A39D1E /* FriendCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F91989D315143CAC00A39D1E /* FriendCell.m */; }; 18 | F91989DA15143CAC00A39D1E /* FriendsViewControler.m in Sources */ = {isa = PBXBuildFile; fileRef = F91989D615143CAC00A39D1E /* FriendsViewControler.m */; }; 19 | F945184C18314C550083D862 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F945184A18314C550083D862 /* Main.storyboard */; }; 20 | F945184E18314FC80083D862 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F945184D18314FC80083D862 /* Images.xcassets */; }; 21 | F9451851183153290083D862 /* HomeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F9451850183153290083D862 /* HomeCell.m */; }; 22 | F95F26DE147DCE8600715CC8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F95F26DD147DCE8500715CC8 /* UIKit.framework */; }; 23 | F95F26E0147DCE8600715CC8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F95F26DF147DCE8600715CC8 /* Foundation.framework */; }; 24 | F95F26E2147DCE8600715CC8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F95F26E1147DCE8600715CC8 /* CoreGraphics.framework */; }; 25 | F95F26E8147DCE8600715CC8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F95F26E6147DCE8600715CC8 /* InfoPlist.strings */; }; 26 | F95F26EA147DCE8600715CC8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F95F26E9147DCE8600715CC8 /* main.m */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 1D55C94341AF8022D0CF03CA /* Pods-SCFacebook.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCFacebook.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SCFacebook/Pods-SCFacebook.debug.xcconfig"; sourceTree = ""; }; 31 | 36F83321DEBF3E783A1E8E4E /* Pods_SCFacebook.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SCFacebook.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 4DF43AC6147EBFB500A7D104 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 33 | 61BAAC1FAC3D227C9A94B272 /* Pods-SCFacebook.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCFacebook.release.xcconfig"; path = "Pods/Target Support Files/Pods-SCFacebook/Pods-SCFacebook.release.xcconfig"; sourceTree = ""; }; 34 | A006C4751BB1B44500F8F728 /* SCFacebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SCFacebook.m; path = ../../SCFacebook/SCFacebook.m; sourceTree = ""; }; 35 | A006C4761BB1B44500F8F728 /* SCFacebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SCFacebook.h; path = ../../SCFacebook/SCFacebook.h; sourceTree = ""; }; 36 | A006F5821BB198290024416F /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Classes/AppDelegate.m; sourceTree = ""; }; 37 | A006F5831BB198290024416F /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Classes/AppDelegate.h; sourceTree = ""; }; 38 | A0A59A82206BE7EA0099885C /* README.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.markdown; path = ../README.markdown; sourceTree = ""; }; 39 | A0C801DD19C3BAE50045D60E /* SCFacebook.mov */ = {isa = PBXFileReference; lastKnownFileType = video.quicktime; path = SCFacebook.mov; sourceTree = ""; }; 40 | F91989CF15143C9700A39D1E /* HomeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HomeController.h; path = Classes/HomeController.h; sourceTree = ""; }; 41 | F91989D015143C9700A39D1E /* HomeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HomeController.m; path = Classes/HomeController.m; sourceTree = ""; }; 42 | F91989D215143CAC00A39D1E /* FriendCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FriendCell.h; path = Classes/FriendCell.h; sourceTree = ""; }; 43 | F91989D315143CAC00A39D1E /* FriendCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FriendCell.m; path = Classes/FriendCell.m; sourceTree = ""; }; 44 | F91989D515143CAC00A39D1E /* FriendsViewControler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FriendsViewControler.h; path = Classes/FriendsViewControler.h; sourceTree = ""; }; 45 | F91989D615143CAC00A39D1E /* FriendsViewControler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FriendsViewControler.m; path = Classes/FriendsViewControler.m; sourceTree = ""; }; 46 | F945184B18314C550083D862 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = SCFacebook/en.lproj/Main.storyboard; sourceTree = ""; }; 47 | F945184D18314FC80083D862 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ../Images.xcassets; sourceTree = ""; }; 48 | F945184F183153290083D862 /* HomeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HomeCell.h; path = Classes/HomeCell.h; sourceTree = ""; }; 49 | F9451850183153290083D862 /* HomeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HomeCell.m; path = Classes/HomeCell.m; sourceTree = ""; }; 50 | F95F26D9147DCE8500715CC8 /* SCFacebook.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SCFacebook.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | F95F26DD147DCE8500715CC8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 52 | F95F26DF147DCE8600715CC8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 53 | F95F26E1147DCE8600715CC8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 54 | F95F26E5147DCE8600715CC8 /* SCFacebook-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCFacebook-Info.plist"; sourceTree = ""; }; 55 | F95F26E7147DCE8600715CC8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | F95F26E9147DCE8600715CC8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | F95F26EB147DCE8600715CC8 /* SCFacebook-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCFacebook-Prefix.pch"; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | F95F26D6147DCE8500715CC8 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 4DF43AC7147EBFB500A7D104 /* QuartzCore.framework in Frameworks */, 66 | F95F26DE147DCE8600715CC8 /* UIKit.framework in Frameworks */, 67 | F95F26E0147DCE8600715CC8 /* Foundation.framework in Frameworks */, 68 | F95F26E2147DCE8600715CC8 /* CoreGraphics.framework in Frameworks */, 69 | 34997647CCBB043F71CE131C /* Pods_SCFacebook.framework in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 3D52FA46E34969B2977D7C95 /* Pods */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 1D55C94341AF8022D0CF03CA /* Pods-SCFacebook.debug.xcconfig */, 80 | 61BAAC1FAC3D227C9A94B272 /* Pods-SCFacebook.release.xcconfig */, 81 | ); 82 | name = Pods; 83 | sourceTree = ""; 84 | }; 85 | A0C801D619C3BAE50045D60E /* Resources */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | F945184D18314FC80083D862 /* Images.xcassets */, 89 | A0C801DC19C3BAE50045D60E /* videos */, 90 | ); 91 | path = Resources; 92 | sourceTree = ""; 93 | }; 94 | A0C801DC19C3BAE50045D60E /* videos */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | A0C801DD19C3BAE50045D60E /* SCFacebook.mov */, 98 | ); 99 | path = videos; 100 | sourceTree = ""; 101 | }; 102 | F94518521831532D0083D862 /* HomeCell */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | F945184F183153290083D862 /* HomeCell.h */, 106 | F9451850183153290083D862 /* HomeCell.m */, 107 | ); 108 | name = HomeCell; 109 | sourceTree = ""; 110 | }; 111 | F9451853183153370083D862 /* Home */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | F91989CF15143C9700A39D1E /* HomeController.h */, 115 | F91989D015143C9700A39D1E /* HomeController.m */, 116 | F94518521831532D0083D862 /* HomeCell */, 117 | ); 118 | name = Home; 119 | sourceTree = ""; 120 | }; 121 | F9564FEA1480561E000A9AA0 /* Classes */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | A006F5831BB198290024416F /* AppDelegate.h */, 125 | A006F5821BB198290024416F /* AppDelegate.m */, 126 | F9451853183153370083D862 /* Home */, 127 | F9694EB5148073B3000B8A59 /* Friend */, 128 | ); 129 | name = Classes; 130 | sourceTree = ""; 131 | }; 132 | F95F26CE147DCE8500715CC8 = { 133 | isa = PBXGroup; 134 | children = ( 135 | A0A59A82206BE7EA0099885C /* README.markdown */, 136 | F945184A18314C550083D862 /* Main.storyboard */, 137 | F95F26E3147DCE8600715CC8 /* SCFacebook */, 138 | F95F26DC147DCE8500715CC8 /* Frameworks */, 139 | F95F26DA147DCE8500715CC8 /* Products */, 140 | 3D52FA46E34969B2977D7C95 /* Pods */, 141 | ); 142 | sourceTree = ""; 143 | }; 144 | F95F26DA147DCE8500715CC8 /* Products */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | F95F26D9147DCE8500715CC8 /* SCFacebook.app */, 148 | ); 149 | name = Products; 150 | sourceTree = ""; 151 | }; 152 | F95F26DC147DCE8500715CC8 /* Frameworks */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 4DF43AC6147EBFB500A7D104 /* QuartzCore.framework */, 156 | F95F26DD147DCE8500715CC8 /* UIKit.framework */, 157 | F95F26DF147DCE8600715CC8 /* Foundation.framework */, 158 | F95F26E1147DCE8600715CC8 /* CoreGraphics.framework */, 159 | 36F83321DEBF3E783A1E8E4E /* Pods_SCFacebook.framework */, 160 | ); 161 | name = Frameworks; 162 | sourceTree = ""; 163 | }; 164 | F95F26E3147DCE8600715CC8 /* SCFacebook */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | A006C4761BB1B44500F8F728 /* SCFacebook.h */, 168 | A006C4751BB1B44500F8F728 /* SCFacebook.m */, 169 | F9564FEA1480561E000A9AA0 /* Classes */, 170 | A0C801D619C3BAE50045D60E /* Resources */, 171 | F95F26E4147DCE8600715CC8 /* Supporting Files */, 172 | ); 173 | path = SCFacebook; 174 | sourceTree = ""; 175 | }; 176 | F95F26E4147DCE8600715CC8 /* Supporting Files */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | F95F26E5147DCE8600715CC8 /* SCFacebook-Info.plist */, 180 | F95F26E6147DCE8600715CC8 /* InfoPlist.strings */, 181 | F95F26E9147DCE8600715CC8 /* main.m */, 182 | F95F26EB147DCE8600715CC8 /* SCFacebook-Prefix.pch */, 183 | ); 184 | name = "Supporting Files"; 185 | sourceTree = ""; 186 | }; 187 | F9694EB5148073B3000B8A59 /* Friend */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | F9694EBB148073E3000B8A59 /* FriendCell */, 191 | F91989D515143CAC00A39D1E /* FriendsViewControler.h */, 192 | F91989D615143CAC00A39D1E /* FriendsViewControler.m */, 193 | ); 194 | name = Friend; 195 | sourceTree = ""; 196 | }; 197 | F9694EBB148073E3000B8A59 /* FriendCell */ = { 198 | isa = PBXGroup; 199 | children = ( 200 | F91989D215143CAC00A39D1E /* FriendCell.h */, 201 | F91989D315143CAC00A39D1E /* FriendCell.m */, 202 | ); 203 | name = FriendCell; 204 | sourceTree = ""; 205 | }; 206 | /* End PBXGroup section */ 207 | 208 | /* Begin PBXNativeTarget section */ 209 | F95F26D8147DCE8500715CC8 /* SCFacebook */ = { 210 | isa = PBXNativeTarget; 211 | buildConfigurationList = F95F26F7147DCE8600715CC8 /* Build configuration list for PBXNativeTarget "SCFacebook" */; 212 | buildPhases = ( 213 | A7E044ED062D54DA9C553E3A /* [CP] Check Pods Manifest.lock */, 214 | F95F26D5147DCE8500715CC8 /* Sources */, 215 | F95F26D6147DCE8500715CC8 /* Frameworks */, 216 | F95F26D7147DCE8500715CC8 /* Resources */, 217 | 8AD86B49252127EAF5C40BC9 /* [CP] Embed Pods Frameworks */, 218 | 2419B97EC2E0559BCED10098 /* [CP] Copy Pods Resources */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | ); 224 | name = SCFacebook; 225 | productName = SCFacebook; 226 | productReference = F95F26D9147DCE8500715CC8 /* SCFacebook.app */; 227 | productType = "com.apple.product-type.application"; 228 | }; 229 | /* End PBXNativeTarget section */ 230 | 231 | /* Begin PBXProject section */ 232 | F95F26D0147DCE8500715CC8 /* Project object */ = { 233 | isa = PBXProject; 234 | attributes = { 235 | LastUpgradeCheck = 0700; 236 | ORGANIZATIONNAME = "SiriusCode Solutions"; 237 | TargetAttributes = { 238 | F95F26D8147DCE8500715CC8 = { 239 | DevelopmentTeam = 6CG326ELR9; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = F95F26D3147DCE8500715CC8 /* Build configuration list for PBXProject "SCFacebook" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | ); 250 | mainGroup = F95F26CE147DCE8500715CC8; 251 | productRefGroup = F95F26DA147DCE8500715CC8 /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | F95F26D8147DCE8500715CC8 /* SCFacebook */, 256 | ); 257 | }; 258 | /* End PBXProject section */ 259 | 260 | /* Begin PBXResourcesBuildPhase section */ 261 | F95F26D7147DCE8500715CC8 /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | F95F26E8147DCE8600715CC8 /* InfoPlist.strings in Resources */, 266 | A0A59A83206BE7EA0099885C /* README.markdown in Resources */, 267 | F945184C18314C550083D862 /* Main.storyboard in Resources */, 268 | A0C801E219C3BAE50045D60E /* SCFacebook.mov in Resources */, 269 | F945184E18314FC80083D862 /* Images.xcassets in Resources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | /* End PBXResourcesBuildPhase section */ 274 | 275 | /* Begin PBXShellScriptBuildPhase section */ 276 | 2419B97EC2E0559BCED10098 /* [CP] Copy Pods Resources */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "[CP] Copy Pods Resources"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SCFacebook/Pods-SCFacebook-resources.sh\"\n"; 289 | showEnvVarsInLog = 0; 290 | }; 291 | 8AD86B49252127EAF5C40BC9 /* [CP] Embed Pods Frameworks */ = { 292 | isa = PBXShellScriptBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | ); 296 | inputPaths = ( 297 | "${SRCROOT}/Pods/Target Support Files/Pods-SCFacebook/Pods-SCFacebook-frameworks.sh", 298 | "${BUILT_PRODUCTS_DIR}/Bolts/Bolts.framework", 299 | "${BUILT_PRODUCTS_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework", 300 | "${BUILT_PRODUCTS_DIR}/FBSDKLoginKit/FBSDKLoginKit.framework", 301 | "${BUILT_PRODUCTS_DIR}/FBSDKShareKit/FBSDKShareKit.framework", 302 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", 303 | ); 304 | name = "[CP] Embed Pods Frameworks"; 305 | outputPaths = ( 306 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bolts.framework", 307 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit.framework", 308 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKLoginKit.framework", 309 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKShareKit.framework", 310 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | shellPath = /bin/sh; 314 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SCFacebook/Pods-SCFacebook-frameworks.sh\"\n"; 315 | showEnvVarsInLog = 0; 316 | }; 317 | A7E044ED062D54DA9C553E3A /* [CP] Check Pods Manifest.lock */ = { 318 | isa = PBXShellScriptBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | ); 322 | inputPaths = ( 323 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 324 | "${PODS_ROOT}/Manifest.lock", 325 | ); 326 | name = "[CP] Check Pods Manifest.lock"; 327 | outputPaths = ( 328 | "$(DERIVED_FILE_DIR)/Pods-SCFacebook-checkManifestLockResult.txt", 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | shellPath = /bin/sh; 332 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 333 | showEnvVarsInLog = 0; 334 | }; 335 | /* End PBXShellScriptBuildPhase section */ 336 | 337 | /* Begin PBXSourcesBuildPhase section */ 338 | F95F26D5147DCE8500715CC8 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | A006C4771BB1B44500F8F728 /* SCFacebook.m in Sources */, 343 | F95F26EA147DCE8600715CC8 /* main.m in Sources */, 344 | F9451851183153290083D862 /* HomeCell.m in Sources */, 345 | A006F5841BB198290024416F /* AppDelegate.m in Sources */, 346 | F91989D115143C9700A39D1E /* HomeController.m in Sources */, 347 | F91989D815143CAC00A39D1E /* FriendCell.m in Sources */, 348 | F91989DA15143CAC00A39D1E /* FriendsViewControler.m in Sources */, 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | }; 352 | /* End PBXSourcesBuildPhase section */ 353 | 354 | /* Begin PBXVariantGroup section */ 355 | F945184A18314C550083D862 /* Main.storyboard */ = { 356 | isa = PBXVariantGroup; 357 | children = ( 358 | F945184B18314C550083D862 /* en */, 359 | ); 360 | name = Main.storyboard; 361 | sourceTree = ""; 362 | }; 363 | F95F26E6147DCE8600715CC8 /* InfoPlist.strings */ = { 364 | isa = PBXVariantGroup; 365 | children = ( 366 | F95F26E7147DCE8600715CC8 /* en */, 367 | ); 368 | name = InfoPlist.strings; 369 | sourceTree = ""; 370 | }; 371 | /* End PBXVariantGroup section */ 372 | 373 | /* Begin XCBuildConfiguration section */ 374 | F95F26F5147DCE8600715CC8 /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ALWAYS_SEARCH_USER_PATHS = NO; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_CONSTANT_CONVERSION = YES; 380 | CLANG_WARN_EMPTY_BODY = YES; 381 | CLANG_WARN_ENUM_CONVERSION = YES; 382 | CLANG_WARN_INT_CONVERSION = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | ENABLE_TESTABILITY = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_OPTIMIZATION_LEVEL = 0; 393 | GCC_PREPROCESSOR_DEFINITIONS = ( 394 | "DEBUG=1", 395 | "$(inherited)", 396 | ); 397 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 398 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 399 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 400 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 407 | ONLY_ACTIVE_ARCH = YES; 408 | SDKROOT = iphoneos; 409 | }; 410 | name = Debug; 411 | }; 412 | F95F26F6147DCE8600715CC8 /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | ALWAYS_SEARCH_USER_PATHS = NO; 416 | CLANG_WARN_BOOL_CONVERSION = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_EMPTY_BODY = YES; 419 | CLANG_WARN_ENUM_CONVERSION = YES; 420 | CLANG_WARN_INT_CONVERSION = YES; 421 | CLANG_WARN_UNREACHABLE_CODE = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 424 | COPY_PHASE_STRIP = YES; 425 | ENABLE_STRICT_OBJC_MSGSEND = YES; 426 | GCC_C_LANGUAGE_STANDARD = gnu99; 427 | GCC_NO_COMMON_BLOCKS = YES; 428 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 437 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 438 | SDKROOT = iphoneos; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | F95F26F8147DCE8600715CC8 /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 1D55C94341AF8022D0CF03CA /* Pods-SCFacebook.debug.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; 449 | CLANG_ENABLE_OBJC_ARC = YES; 450 | DEVELOPMENT_TEAM = 6CG326ELR9; 451 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 452 | GCC_PREFIX_HEADER = "SCFacebook/SCFacebook-Prefix.pch"; 453 | INFOPLIST_FILE = "SCFacebook/SCFacebook-Info.plist"; 454 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 455 | PRODUCT_BUNDLE_IDENTIFIER = com.siriuscode.teste; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | TARGETED_DEVICE_FAMILY = 1; 458 | WRAPPER_EXTENSION = app; 459 | }; 460 | name = Debug; 461 | }; 462 | F95F26F9147DCE8600715CC8 /* Release */ = { 463 | isa = XCBuildConfiguration; 464 | baseConfigurationReference = 61BAAC1FAC3D227C9A94B272 /* Pods-SCFacebook.release.xcconfig */; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 467 | CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; 468 | CLANG_ENABLE_OBJC_ARC = YES; 469 | DEVELOPMENT_TEAM = 6CG326ELR9; 470 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 471 | GCC_PREFIX_HEADER = "SCFacebook/SCFacebook-Prefix.pch"; 472 | INFOPLIST_FILE = "SCFacebook/SCFacebook-Info.plist"; 473 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 474 | PRODUCT_BUNDLE_IDENTIFIER = com.siriuscode.teste; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | TARGETED_DEVICE_FAMILY = 1; 477 | WRAPPER_EXTENSION = app; 478 | }; 479 | name = Release; 480 | }; 481 | /* End XCBuildConfiguration section */ 482 | 483 | /* Begin XCConfigurationList section */ 484 | F95F26D3147DCE8500715CC8 /* Build configuration list for PBXProject "SCFacebook" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | F95F26F5147DCE8600715CC8 /* Debug */, 488 | F95F26F6147DCE8600715CC8 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | F95F26F7147DCE8600715CC8 /* Build configuration list for PBXNativeTarget "SCFacebook" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | F95F26F8147DCE8600715CC8 /* Debug */, 497 | F95F26F9147DCE8600715CC8 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | /* End XCConfigurationList section */ 503 | }; 504 | rootObject = F95F26D0147DCE8500715CC8 /* Project object */; 505 | } 506 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011 Siriuscode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HomeController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011 Siriuscode Solutions. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "HomeController.h" 12 | #import "SCFacebook.h" 13 | 14 | @implementation AppDelegate 15 | 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | 19 | /** 20 | Init SCFacebook 21 | Add the necessary permissions 22 | 23 | If your app asks for more than than public_profile and email, it will require review by Facebook before your app can be used by people other than the app's developers. 24 | 25 | The time to review your app is usually about 7 business days. Some extra-sensitive permissions, as noted below, can take up to 14 business days. 26 | 27 | https://developers.facebook.com/docs/facebook-login/permissions/review 28 | **/ 29 | [SCFacebook initWithReadPermissions:@[ 30 | @"user_about_me", 31 | @"user_birthday", 32 | @"email", 33 | @"user_photos", 34 | @"user_events", 35 | @"user_friends", 36 | @"user_videos", 37 | @"public_profile"] 38 | publishPermissions:@[ 39 | @"manage_pages", 40 | @"publish_actions", 41 | @"publish_pages" 42 | ] 43 | ]; 44 | 45 | [FBSDKProfile enableUpdatesOnAccessTokenChange:YES]; 46 | return [[FBSDKApplicationDelegate sharedInstance] application:application 47 | didFinishLaunchingWithOptions:launchOptions]; 48 | 49 | } 50 | 51 | 52 | 53 | 54 | #pragma mark - 55 | #pragma mark - SCFacebook Handle 56 | 57 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 58 | return [[FBSDKApplicationDelegate sharedInstance] application:application 59 | openURL:url 60 | sourceApplication:sourceApplication 61 | annotation:annotation]; 62 | } 63 | 64 | - (void)applicationDidBecomeActive:(UIApplication *)application { 65 | [FBSDKAppEvents activateApp]; 66 | 67 | // Do the following if you use Mobile App Engagement Ads to get the deferred 68 | // app link after your app is installed. 69 | [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) { 70 | if (error) { 71 | NSLog(@"Received error while fetching deferred app link %@", error); 72 | } 73 | if (url) { 74 | [[UIApplication sharedApplication] openURL:url]; 75 | } 76 | }]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/FriendCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCell.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 25/11/11. 6 | // Copyright (c) 2011 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCell : UITableViewCell 12 | 13 | @property (nonatomic,strong) IBOutlet UIImageView *photoImageView; 14 | @property (nonatomic,strong) IBOutlet UILabel *nameLabel; 15 | 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/FriendCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCell.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 25/11/11. 6 | // Copyright (c) 2011 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import "FriendCell.h" 10 | 11 | @implementation FriendCell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | self.selectionStyle = UITableViewCellSelectionStyleNone; 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/FriendsViewControler.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendsViewControler.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 25/11/11. 6 | // Copyright (c) 2011 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendsViewControler : UIViewController 12 | 13 | @property (nonatomic, strong) NSMutableArray *friendsArray; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/FriendsViewControler.m: -------------------------------------------------------------------------------- 1 | // 2 | // FriendsViewControler.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 25/11/11. 6 | // Copyright (c) 2011 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import "FriendsViewControler.h" 10 | #import "FriendCell.h" 11 | 12 | #import 13 | 14 | @implementation FriendsViewControler 15 | 16 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 17 | { 18 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 19 | if (self) { 20 | // Custom initialization 21 | } 22 | return self; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning 26 | { 27 | // Releases the view if it doesn't have a superview. 28 | [super didReceiveMemoryWarning]; 29 | 30 | // Release any cached data, images, etc that aren't in use. 31 | } 32 | 33 | #pragma mark - View lifecycle 34 | 35 | - (void)viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | // Do any additional setup after loading the view from its nib. 39 | self.title = @"Friends"; 40 | 41 | NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; 42 | [self.friendsArray sortUsingDescriptors:@[sortDescriptor]]; 43 | } 44 | 45 | - (void)viewDidUnload 46 | { 47 | self.friendsArray = nil; 48 | [super viewDidUnload]; 49 | // Release any retained subviews of the main view. 50 | // e.g. self.myOutlet = nil; 51 | } 52 | 53 | 54 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 55 | { 56 | // Return YES for supported orientations 57 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 58 | } 59 | 60 | 61 | #pragma mark - 62 | #pragma mark - Table view data source 63 | 64 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 65 | { 66 | return 80.0; 67 | } 68 | 69 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 70 | { 71 | return 1; 72 | } 73 | 74 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 75 | { 76 | return [self.friendsArray count]; 77 | } 78 | 79 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 80 | { 81 | static NSString *CellIdentifier = @"FriendCell"; 82 | 83 | FriendCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 84 | 85 | cell.nameLabel.text = self.friendsArray[indexPath.row][@"name"]; 86 | 87 | [cell.photoImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", self.friendsArray[indexPath.row][@"id"]]]]; 88 | cell.selectionStyle = UITableViewCellSelectionStyleGray; 89 | return cell; 90 | } 91 | 92 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 93 | { 94 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/HomeCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeCell.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 11/11/13. 6 | // Copyright (c) 2013 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HomeCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/HomeCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeCell.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 11/11/13. 6 | // Copyright (c) 2013 SiriusCode Solutions. All rights reserved. 7 | // 8 | 9 | #import "HomeCell.h" 10 | 11 | @implementation HomeCell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/HomeController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HomeController.h 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011 Siriuscode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HomeController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /sample/SCFacebook/Classes/HomeController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HomeController.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011 Siriuscode Solutions. All rights reserved. 7 | // 8 | 9 | #import "HomeController.h" 10 | #import "SCFacebook.h" 11 | #import "FriendsViewControler.h" 12 | #import "HomeCell.h" 13 | 14 | #import 15 | 16 | #define RemoveNull(field) ([[result objectForKey:field] isKindOfClass:[NSNull class]]) ? @"" : [result objectForKey:field]; 17 | 18 | @interface HomeController (){ 19 | UIView *loadingView; 20 | } 21 | 22 | @property (strong, nonatomic) NSMutableArray *itemsArray; 23 | @property (strong, nonatomic) UIActionSheet *userSheet; 24 | @property (strong, nonatomic) UIActionSheet *openGraphSheet; 25 | @property (strong, nonatomic) UIActionSheet *pageSheet; 26 | @property (strong, nonatomic) UIActionSheet *albumSheet; 27 | 28 | @end 29 | 30 | 31 | @implementation HomeController 32 | 33 | - (void)didReceiveMemoryWarning 34 | { 35 | [super didReceiveMemoryWarning]; 36 | // Release any cached data, images, etc that aren't in use. 37 | } 38 | 39 | #pragma mark - View lifecycle 40 | 41 | - (void)viewDidLoad { 42 | [super viewDidLoad]; 43 | // Do any additional setup after loading the view, typically from a nib. 44 | self.title = @"SCFacebook"; 45 | 46 | //Loading 47 | loadingView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; 48 | loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.8]; 49 | UIActivityIndicatorView *aiView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; 50 | [loadingView addSubview:aiView]; 51 | [aiView startAnimating]; 52 | aiView.center = self.view.center; 53 | [self.navigationController.view addSubview:loadingView]; 54 | loadingView.hidden = YES; 55 | 56 | [self.itemsArray addObject:@"Login"]; 57 | [self.itemsArray addObject:@"Logout"]; 58 | [self.itemsArray addObject:@"Get User info"]; 59 | [self.itemsArray addObject:@"Get Friends"]; 60 | [self.itemsArray addObject:@"Publish to your wall"]; 61 | [self.itemsArray addObject:@"Invite Friends"]; 62 | [self.itemsArray addObject:@"OpenGraph"]; 63 | [self.itemsArray addObject:@"Pages"]; 64 | [self.itemsArray addObject:@"Albums"]; 65 | } 66 | 67 | - (void)viewDidUnload { 68 | [super viewDidUnload]; 69 | } 70 | 71 | 72 | #pragma mark - 73 | #pragma mark - Property 74 | 75 | - (NSMutableArray *)itemsArray { 76 | if(!_itemsArray) _itemsArray = [[NSMutableArray alloc] init]; 77 | return _itemsArray; 78 | } 79 | 80 | 81 | #pragma mark - 82 | #pragma mark - UIStoryboardSegue Delegate 83 | 84 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 85 | if ([segue.identifier isEqualToString:@"FriendSegue"]) { 86 | FriendsViewControler *friendsViewController = segue.destinationViewController; 87 | friendsViewController.friendsArray = sender; 88 | } 89 | } 90 | 91 | 92 | 93 | #pragma mark - 94 | #pragma mark - Methods 95 | 96 | 97 | - (void)showMessage:(NSString *)message { 98 | if ([UIAlertController class]) { 99 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alert" message:message preferredStyle:UIAlertControllerStyleAlert]; 100 | 101 | UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 102 | [alertController addAction:ok]; 103 | 104 | [self presentViewController:alertController animated:YES completion:nil]; 105 | 106 | } else { 107 | [[[UIAlertView alloc]initWithTitle:@"Alert" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; 108 | } 109 | } 110 | 111 | - (void)getUserInfo { 112 | loadingView.hidden = NO; 113 | 114 | [SCFacebook getUserFields:@"id, name, email, birthday, about, picture" callBack:^(BOOL success, id result) { 115 | if (success) { 116 | NSLog(@"%@", result); 117 | loadingView.hidden = YES; 118 | }else{ 119 | loadingView.hidden = YES; 120 | [self showMessage:[result description]]; 121 | } 122 | }]; 123 | } 124 | 125 | - (void)login { 126 | loadingView.hidden = NO; 127 | [self.navigationController popViewControllerAnimated:NO]; 128 | 129 | [SCFacebook loginCallBack:^(BOOL success, id result) { 130 | loadingView.hidden = YES; 131 | 132 | if (success) { 133 | [self showMessage:@"Success"]; 134 | }else{ 135 | [self showMessage:[result description]]; 136 | } 137 | }]; 138 | } 139 | 140 | - (void)logout { 141 | [SCFacebook logoutCallBack:^(BOOL success, id result) { 142 | if (success) { 143 | [self showMessage:[result description]]; 144 | } 145 | }]; 146 | } 147 | 148 | - (void)getFriends { 149 | loadingView.hidden = NO; 150 | 151 | [SCFacebook getUserFriendsFields:@"id,name" callBack:^(BOOL success, id result) { 152 | loadingView.hidden = YES; 153 | if (success) { 154 | 155 | [self performSegueWithIdentifier:@"FriendSegue" sender:[result[@"data"] mutableCopy]]; 156 | }else{ 157 | [self showMessage:[result description]]; 158 | } 159 | }]; 160 | } 161 | 162 | - (void)publishYourWall { 163 | self.userSheet = [[UIActionSheet alloc] 164 | initWithTitle:@"Option Publish" 165 | delegate:self 166 | cancelButtonTitle:nil 167 | destructiveButtonTitle:@"Cancel" 168 | otherButtonTitles:@"Message", @"Link", @"Photo", @"Video", nil]; 169 | self.userSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; 170 | [self.userSheet showFromRect:self.view.bounds inView:self.view animated:YES]; 171 | } 172 | 173 | - (void)publishPageWall { 174 | self.pageSheet = [[UIActionSheet alloc] 175 | initWithTitle:@"Option Pages" 176 | delegate:self 177 | cancelButtonTitle:nil 178 | destructiveButtonTitle:@"Cancel" 179 | otherButtonTitles: 180 | @"Get Pages", 181 | @"Message", 182 | @"Message + Photo", 183 | @"Message + Link", 184 | @"Title + Description + Video", 185 | @"Admin Message", 186 | @"Admin Message + Link", 187 | @"Admin Message + Photo", 188 | @"Admin Title + Description + Video", nil]; 189 | self.pageSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; 190 | [self.pageSheet showFromRect:self.view.bounds inView:self.view animated:YES]; 191 | } 192 | 193 | - (void)publishAlbums { 194 | self.albumSheet = [[UIActionSheet alloc] 195 | initWithTitle:@"Option Albums" 196 | delegate:self 197 | cancelButtonTitle:nil 198 | destructiveButtonTitle:@"Cancel" 199 | otherButtonTitles: 200 | @"Get Albums", 201 | @"Get AlbumId", 202 | @"Get Photos the album", 203 | @"Create Album", 204 | @"Post Photo in album", nil]; 205 | self.albumSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; 206 | [self.albumSheet showFromRect:self.view.bounds inView:self.view animated:YES]; 207 | } 208 | 209 | - (void)publishOpenGraph { 210 | self.openGraphSheet = [[UIActionSheet alloc] 211 | initWithTitle:@"Option Open Graph - Custom Stories" 212 | delegate:self 213 | cancelButtonTitle:nil 214 | destructiveButtonTitle:@"Cancel" 215 | otherButtonTitles: 216 | @"Post open graph", 217 | @"Post open graph with image upload",nil]; 218 | self.openGraphSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; 219 | [self.openGraphSheet showFromRect:self.view.bounds inView:self.view animated:YES]; 220 | } 221 | 222 | - (void)openGraph { 223 | loadingView.hidden = NO; 224 | 225 | // Create an object 226 | NSURL *imageURL = [NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]; 227 | FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImageURL:imageURL userGenerated:NO]; 228 | NSDictionary *properties = @{ 229 | @"og:type": @"fblucasnamespace:actionobjecttype", 230 | @"og:title": @"Sample ActionObjectType", 231 | @"og:description": @"fdsfdfsdfsdfdsfsdf", 232 | @"og:url": @"http://www.lucascorrea.com", 233 | @"og:image": @[photo] 234 | }; 235 | FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties]; 236 | 237 | [SCFacebook sendForPostOpenGraphWithActionType:@"fblucasnamespace:actiontest" graphObject:object objectName:@"actionobjecttype" viewController:self callBack:^(BOOL success, id result) { 238 | loadingView.hidden = YES; 239 | if (success) { 240 | [self showMessage:[result description]]; 241 | }else{ 242 | [self showMessage:[result description]]; 243 | } 244 | }]; 245 | } 246 | 247 | - (void)openGraphWithImage { 248 | loadingView.hidden = NO; 249 | 250 | // Create an object 251 | UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]]]; 252 | FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImage:image userGenerated:NO]; 253 | NSDictionary *properties = @{ 254 | @"og:type": @"fblucasnamespace:actionobjecttype", 255 | @"og:title": @"Sample ActionObjectType", 256 | @"og:description": @"fdsfdfsdfsdfdsfsdf", 257 | @"og:url": @"http://www.lucascorrea.com", 258 | @"og:image": @[photo] 259 | }; 260 | FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties]; 261 | 262 | [SCFacebook sendForPostOpenGraphWithActionType:@"fblucasnamespace:actiontest" graphObject:object objectName:@"actionobjecttype" viewController:self callBack:^(BOOL success, id result) { 263 | loadingView.hidden = YES; 264 | if (success) { 265 | [self showMessage:[result description]]; 266 | }else{ 267 | [self showMessage:[result description]]; 268 | } 269 | }]; 270 | } 271 | 272 | 273 | - (void)inviteFriends { 274 | NSURL *appLink = [NSURL URLWithString:@"https://fb.me/1026080090769628"]; 275 | NSURL *previewImage = [NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]; 276 | 277 | #pragma clang diagnostic push 278 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 279 | 280 | [SCFacebook inviteFriendsWithAppLinkURL:appLink previewImageURL:previewImage callBack:^(BOOL success, id result) { 281 | if (success) { 282 | [self showMessage:[result description]]; 283 | }else{ 284 | [self showMessage:[result description]]; 285 | } 286 | }]; 287 | #pragma clang diagnostic pop 288 | } 289 | 290 | 291 | 292 | 293 | #pragma mark - 294 | #pragma mark - UIActionSheetDelegate 295 | 296 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 297 | if (buttonIndex == actionSheet.destructiveButtonIndex) { return; } 298 | 299 | if (self.userSheet == actionSheet) { 300 | 301 | switch (buttonIndex) { 302 | 303 | //Message 304 | case 1:{ 305 | loadingView.hidden = NO; 306 | [SCFacebook feedPostWithMessage:@"This is message" callBack:^(BOOL success, id result) { 307 | loadingView.hidden = YES; 308 | [self showMessage:[result description]]; 309 | }]; 310 | } 311 | break; 312 | 313 | //Link 314 | case 2:{ 315 | loadingView.hidden = NO; 316 | [SCFacebook feedPostWithLinkPath:@"http://www.lucascorrea.com" caption:@"Portfolio" callBack:^(BOOL success, id result) { 317 | loadingView.hidden = YES; 318 | [self showMessage:[result description]]; 319 | }]; 320 | } 321 | 322 | break; 323 | //Photo 324 | case 3:{ 325 | UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]]]; 326 | loadingView.hidden = NO; 327 | [SCFacebook feedPostWithPhoto:image caption:@"This is message with photo" callBack:^(BOOL success, id result) { 328 | loadingView.hidden = YES; 329 | [self showMessage:[result description]]; 330 | }]; 331 | } 332 | break; 333 | //Movie 334 | case 4:{ 335 | loadingView.hidden = NO; 336 | 337 | NSString *filePath = [[NSBundle mainBundle] pathForResource:@"SCFacebook" ofType:@"mov"]; 338 | NSData *videoData = [NSData dataWithContentsOfFile:filePath]; 339 | 340 | [SCFacebook feedPostWithVideo:videoData title:@"This is title" description:@"This is description" callBack:^(BOOL success, id result) { 341 | loadingView.hidden = YES; 342 | [self showMessage:[result description]]; 343 | }]; 344 | 345 | } 346 | break; 347 | default: 348 | break; 349 | } 350 | } 351 | 352 | //Pages and Page Admin 353 | else if (self.pageSheet == actionSheet) { 354 | 355 | switch (buttonIndex) { 356 | 357 | //Get Pages 358 | case 1:{ 359 | loadingView.hidden = NO; 360 | [SCFacebook getPagesCallBack:^(BOOL success, id result) { 361 | loadingView.hidden = YES; 362 | [self showMessage:[result description]]; 363 | }]; 364 | } 365 | break; 366 | 367 | //Message 368 | case 2:{ 369 | loadingView.hidden = NO; 370 | 371 | // Facebook Web address ou pageId 372 | // Example http://www.lucascorrea.com/PageId.png 373 | [SCFacebook feedPostForPage:@"633641776679599" message:@"This is message" callBack:^(BOOL success, id result) { 374 | loadingView.hidden = YES; 375 | [self showMessage:[result description]]; 376 | }]; 377 | } 378 | break; 379 | 380 | //Message + Photo 381 | case 3:{ 382 | loadingView.hidden = NO; 383 | UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]]]; 384 | 385 | // Facebook Web address ou pageId 386 | // Example http://www.lucascorrea.com/PageId.png 387 | [SCFacebook feedPostForPage:@"633641776679599" message:@"This is message with photo" photo:image callBack:^(BOOL success, id result) { 388 | loadingView.hidden = YES; 389 | [self showMessage:[result description]]; 390 | }]; 391 | 392 | } 393 | break; 394 | 395 | //Message + Link 396 | case 4:{ 397 | loadingView.hidden = NO; 398 | 399 | // Facebook Web address ou pageId 400 | // Example http://www.lucascorrea.com/PageId.png 401 | [SCFacebook feedPostForPage:@"633641776679599" message:@"This is message" link:@"http://www.lucascorrea.com" callBack:^(BOOL success, id result) { 402 | loadingView.hidden = YES; 403 | [self showMessage:[result description]]; 404 | }]; 405 | 406 | } 407 | break; 408 | 409 | //Video + title + description 410 | case 5:{ 411 | loadingView.hidden = NO; 412 | NSString *filePath = [[NSBundle mainBundle] pathForResource:@"SCFacebook" ofType:@"mov"]; 413 | NSData *videoData = [NSData dataWithContentsOfFile:filePath]; 414 | 415 | // Facebook Web address ou pageId 416 | // Example http://www.lucascorrea.com/PageId.png 417 | [SCFacebook feedPostForPage:@"633641776679599" video:videoData title:@"This is title" description:@"This is description" callBack:^(BOOL success, id result) { 418 | loadingView.hidden = YES; 419 | [self showMessage:[result description]]; 420 | }]; 421 | } 422 | break; 423 | 424 | // Admin Message 425 | case 6:{ 426 | loadingView.hidden = NO; 427 | 428 | // Facebook Web address 429 | // Example http://www.lucascorrea.com/PageId.png 430 | [SCFacebook feedPostAdminForPageName:@"Empresa Teste" message:@"This is message" callBack:^(BOOL success, id result) { 431 | loadingView.hidden = YES; 432 | [self showMessage:[result description]]; 433 | }]; 434 | } 435 | break; 436 | 437 | // Admin Message + Link 438 | case 7:{ 439 | loadingView.hidden = NO; 440 | 441 | // Facebook Web address 442 | // Example http://www.lucascorrea.com/PageId.png 443 | [SCFacebook feedPostAdminForPageName:@"Empresa Teste" message:@"This is message" link:@"http://www.lucascorrea.com" callBack:^(BOOL success, id result) { 444 | loadingView.hidden = YES; 445 | [self showMessage:[result description]]; 446 | }]; 447 | 448 | } 449 | break; 450 | 451 | // Admin Message + Photo 452 | case 8:{ 453 | loadingView.hidden = NO; 454 | UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]]]; 455 | 456 | // Facebook Web address 457 | // Example http://www.lucascorrea.com/PageId.png 458 | [SCFacebook feedPostAdminForPageName:@"Empresa Teste" message:@"This is message" photo:image callBack:^(BOOL success, id result) { 459 | loadingView.hidden = YES; 460 | [self showMessage:[result description]]; 461 | }]; 462 | } 463 | break; 464 | 465 | //Admin Video + title + description 466 | case 9:{ 467 | loadingView.hidden = NO; 468 | NSString *filePath = [[NSBundle mainBundle] pathForResource:@"SCFacebook" ofType:@"mov"]; 469 | NSData *videoData = [NSData dataWithContentsOfFile:filePath]; 470 | 471 | // Facebook Web address 472 | // Example http://www.lucascorrea.com/PageId.png 473 | [SCFacebook feedPostAdminForPageName:@"Empresa Teste" video:videoData title:@"This is title" description:@"This is description" callBack:^(BOOL success, id result) { 474 | loadingView.hidden = YES; 475 | [self showMessage:[result description]]; 476 | }]; 477 | 478 | } 479 | break; 480 | 481 | default: 482 | break; 483 | } 484 | } 485 | 486 | //Albums 487 | else if (self.albumSheet == actionSheet) { 488 | 489 | switch (buttonIndex) { 490 | 491 | //Get Albums 492 | case 1:{ 493 | loadingView.hidden = NO; 494 | [SCFacebook getAlbumsCallBack:^(BOOL success, id result) { 495 | loadingView.hidden = YES; 496 | [self showMessage:[result description]]; 497 | }]; 498 | } 499 | break; 500 | 501 | //Get AlbumId 502 | case 2:{ 503 | loadingView.hidden = NO; 504 | [SCFacebook getAlbumById:@"103540609708919" callBack:^(BOOL success, id result) { 505 | loadingView.hidden = YES; 506 | [self showMessage:[result description]]; 507 | }]; 508 | } 509 | break; 510 | 511 | //Get Photos the album 512 | case 3:{ 513 | loadingView.hidden = NO; 514 | [SCFacebook getPhotosAlbumById:@"103540609708919" callBack:^(BOOL success, id result) { 515 | loadingView.hidden = YES; 516 | [self showMessage:[result description]]; 517 | }]; 518 | } 519 | break; 520 | 521 | //Create Album 522 | case 4:{ 523 | loadingView.hidden = NO; 524 | [SCFacebook createAlbumName:@"Album test" message:@"This is message" privacy: FBAlbumPrivacySelf callBack:^(BOOL success, id result) { 525 | loadingView.hidden = YES; 526 | [self showMessage:[result description]]; 527 | }]; 528 | } 529 | break; 530 | 531 | //Post Photo in album 532 | case 5:{ 533 | loadingView.hidden = NO; 534 | 535 | UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.lucascorrea.com/lucas_apple.png"]]]; 536 | [SCFacebook feedPostForAlbumId:@"103540609708919" photo:image callBack:^(BOOL success, id result) { 537 | loadingView.hidden = YES; 538 | [self showMessage:[result description]]; 539 | }]; 540 | } 541 | break; 542 | 543 | default: 544 | break; 545 | } 546 | } 547 | 548 | //Open graph 549 | else if (self.openGraphSheet == actionSheet) { 550 | switch (buttonIndex) { 551 | case 1: 552 | [self openGraph]; 553 | break; 554 | case 2: 555 | [self openGraphWithImage]; 556 | break; 557 | 558 | default: 559 | break; 560 | } 561 | } 562 | } 563 | 564 | 565 | 566 | #pragma mark - 567 | #pragma mark - Table view data source 568 | 569 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 570 | return 1; 571 | } 572 | 573 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 574 | return [self.itemsArray count]; 575 | } 576 | 577 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 578 | static NSString *CellIdentifier = @"Cell"; 579 | HomeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 580 | 581 | cell.textLabel.text = self.itemsArray[indexPath.row]; 582 | 583 | return cell; 584 | } 585 | 586 | 587 | 588 | #pragma mark - 589 | #pragma mark - Table view delegate 590 | 591 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 592 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 593 | 594 | if (indexPath.row == 0) { 595 | [self login]; 596 | }else if (indexPath.row == 1) { 597 | [self logout]; 598 | }else if (indexPath.row == 2) { 599 | [self getUserInfo]; 600 | }else if (indexPath.row == 3) { 601 | [self getFriends]; 602 | }else if (indexPath.row == 4) { 603 | [self publishYourWall]; 604 | }else if (indexPath.row == 5) { 605 | [self inviteFriends]; 606 | }else if (indexPath.row == 6) { 607 | [self publishOpenGraph]; 608 | }else if (indexPath.row == 7) { 609 | [self publishPageWall]; 610 | }else if (indexPath.row == 8) { 611 | [self publishAlbums]; 612 | } 613 | } 614 | 615 | @end 616 | -------------------------------------------------------------------------------- /sample/SCFacebook/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "3x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "3x" 27 | }, 28 | { 29 | "size" : "57x57", 30 | "idiom" : "iphone", 31 | "filename" : "icon.png", 32 | "scale" : "1x" 33 | }, 34 | { 35 | "size" : "57x57", 36 | "idiom" : "iphone", 37 | "filename" : "icon@2x.png", 38 | "scale" : "2x" 39 | }, 40 | { 41 | "size" : "60x60", 42 | "idiom" : "iphone", 43 | "filename" : "icon@3x.png", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "idiom" : "iphone", 48 | "size" : "60x60", 49 | "scale" : "3x" 50 | } 51 | ], 52 | "info" : { 53 | "version" : 1, 54 | "author" : "xcode" 55 | } 56 | } -------------------------------------------------------------------------------- /sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucascorrea/SCFacebook/dd3509dbf883e057a7ce6990c6ba1ece1dfde6aa/sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon.png -------------------------------------------------------------------------------- /sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucascorrea/SCFacebook/dd3509dbf883e057a7ce6990c6ba1ece1dfde6aa/sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon@2x.png -------------------------------------------------------------------------------- /sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucascorrea/SCFacebook/dd3509dbf883e057a7ce6990c6ba1ece1dfde6aa/sample/SCFacebook/Images.xcassets/AppIcon.appiconset/icon@3x.png -------------------------------------------------------------------------------- /sample/SCFacebook/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /sample/SCFacebook/Resources/videos/SCFacebook.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucascorrea/SCFacebook/dd3509dbf883e057a7ce6990c6ba1ece1dfde6aa/sample/SCFacebook/Resources/videos/SCFacebook.mov -------------------------------------------------------------------------------- /sample/SCFacebook/SCFacebook-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | icon.png 14 | icon@2x.png 15 | 16 | CFBundleIcons 17 | 18 | CFBundleIcons~ipad 19 | 20 | CFBundleIdentifier 21 | $(PRODUCT_BUNDLE_IDENTIFIER) 22 | CFBundleInfoDictionaryVersion 23 | 6.0 24 | CFBundleName 25 | ${PRODUCT_NAME} 26 | CFBundlePackageType 27 | APPL 28 | CFBundleShortVersionString 29 | 1.0 30 | CFBundleSignature 31 | ???? 32 | CFBundleURLTypes 33 | 34 | 35 | CFBundleTypeRole 36 | Editor 37 | CFBundleURLSchemes 38 | 39 | fb2036276259719790 40 | 41 | 42 | 43 | CFBundleTypeRole 44 | Editor 45 | CFBundleURLSchemes 46 | 47 | scfacebook://test 48 | 49 | 50 | 51 | CFBundleVersion 52 | 1.0 53 | FacebookAppID 54 | 2036276259719790 55 | FacebookDisplayName 56 | S C F A C E B O O K 57 | LSApplicationQueriesSchemes 58 | 59 | fbauth 60 | fbapi 61 | fbauth2 62 | fbapi20130214 63 | fbapi20130410 64 | fbapi20130702 65 | fbapi20131010 66 | fbapi20131219 67 | fbapi20140410 68 | fbapi20140116 69 | fbapi20150313 70 | fbapi20150629 71 | fbapi20160328 72 | fb-messenger-api20140430 73 | 74 | LSRequiresIPhoneOS 75 | 76 | NSAppTransportSecurity 77 | 78 | NSAllowsArbitraryLoads 79 | 80 | NSExceptionDomains 81 | 82 | akamaihd.net 83 | 84 | NSExceptionRequiresForwardSecrecy 85 | 86 | NSIncludesSubdomains 87 | 88 | 89 | facebook.com 90 | 91 | NSExceptionRequiresForwardSecrecy 92 | 93 | NSIncludesSubdomains 94 | 95 | 96 | fbcdn.net 97 | 98 | NSExceptionRequiresForwardSecrecy 99 | 100 | NSIncludesSubdomains 101 | 102 | 103 | 104 | 105 | UILaunchStoryboardName 106 | Main 107 | UIMainStoryboardFile 108 | Main 109 | UIPrerenderedIcon 110 | 111 | UIRequiredDeviceCapabilities 112 | 113 | armv7 114 | 115 | UIStatusBarHidden 116 | 117 | UIStatusBarStyle 118 | UIStatusBarStyleDefault 119 | UISupportedInterfaceOrientations 120 | 121 | UIInterfaceOrientationPortrait 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /sample/SCFacebook/SCFacebook-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SCFacebook' target in the 'SCFacebook' project 3 | // 4 | 5 | #import 6 | 7 | 8 | #ifndef __IPHONE_4_0 9 | #warning "This project uses features only available in iOS SDK 4.0 and later." 10 | #endif 11 | 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sample/SCFacebook/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /sample/SCFacebook/en.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /sample/SCFacebook/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SCFacebook 4 | // 5 | // Created by Lucas Correa on 23/11/11. 6 | // Copyright (c) 2011 Siriuscode Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------