質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Facebook

Facebookは、実名登録制のSNS(ソーシャル・ネットワーキング・サービス)です。開発者用のデベロッパーサイトが存在し、一般ユーザーによるFacebook向けアプリケーション開発が可能です。

Q&A

0回答

775閲覧

(Objective-C)FBSDKのログインボタンが反応しない。

_cocapeach

総合スコア20

Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Facebook

Facebookは、実名登録制のSNS(ソーシャル・ネットワーキング・サービス)です。開発者用のデベロッパーサイトが存在し、一般ユーザーによるFacebook向けアプリケーション開発が可能です。

0グッド

0クリップ

投稿2018/12/14 15:08

お世話になります。
Objective-CでFaceBookにログイン機能を実装しようとしており。
facebook for developersのクイックスタートを見て、
サンプル通りに作ってみたのですが、ログインボタンを押下しても反応しません。
特にエラー等のログも出ておらず、何が足りていないのか、わからないので、
ご教授頂けますと幸いです。

実装手順
1.FaceBookに開発者登録
2.CocoaPodsでSDKを取得

Podfile

1# Uncomment the next line to define a global platform for your project 2# platform :ios, '9.0' 3 4target 'sample' do 5 # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 # use_frameworks! 7 8 # Pods for sample 9pod 'FBSDKLoginKit' 10 11 target 'sampleTests' do 12 inherit! :search_paths 13 # Pods for testing 14 end 15 16 target 'sampleUITests' do 17 inherit! :search_paths 18 # Pods for testing 19 end 20 21end 22

3.FaceBookにアプリを登録
4.FaceBookにアプリのバンドルIDを登録
5.アプリのシングルサインオンを有効にする
6.Xcodeでinfo_plistに値を追加

Info.plist

1//Info.plist 2<?xml version="1.0" encoding="UTF-8"?> 3<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 4<plist version="1.0"> 5<dict> 6 <key>CFBundleDevelopmentRegion</key> 7 <string>$(DEVELOPMENT_LANGUAGE)</string> 8 <key>CFBundleExecutable</key> 9 <string>$(EXECUTABLE_NAME)</string> 10 <key>CFBundleIdentifier</key> 11 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 12 <key>CFBundleInfoDictionaryVersion</key> 13 <string>6.0</string> 14 <key>CFBundleName</key> 15 <string>$(PRODUCT_NAME)</string> 16 <key>CFBundlePackageType</key> 17 <string>APPL</string> 18 <key>CFBundleShortVersionString</key> 19 <string>1.0</string> 20 <key>CFBundleVersion</key> 21 <string>1</string> 22 <key>LSRequiresIPhoneOS</key> 23 <true/> 24 <key>UILaunchStoryboardName</key> 25 <string>LaunchScreen</string> 26 <key>UIMainStoryboardFile</key> 27 <string>Main</string> 28 <key>UIRequiredDeviceCapabilities</key> 29 <array> 30 <string>armv7</string> 31 </array> 32 <key>UISupportedInterfaceOrientations</key> 33 <array> 34 <string>UIInterfaceOrientationPortrait</string> 35 <string>UIInterfaceOrientationLandscapeLeft</string> 36 <string>UIInterfaceOrientationLandscapeRight</string> 37 </array> 38 <key>UISupportedInterfaceOrientations~ipad</key> 39 <array> 40 <string>UIInterfaceOrientationPortrait</string> 41 <string>UIInterfaceOrientationPortraitUpsideDown</string> 42 <string>UIInterfaceOrientationLandscapeLeft</string> 43 <string>UIInterfaceOrientationLandscapeRight</string> 44 </array> 45 <key>CFBundleURLTypes</key> 46 <array> 47 <dict> 48 <key>CFBundleURLSchemes</key> 49 <array> 50 <string>fb269286210426521</string> 51 </array> 52 </dict> 53 </array> 54 <key>FacebookAppID</key> 55 <string>269286210426521</string> 56 <key>FacebookDisplayName</key> 57 <string>sample</string> 58 <key>LSApplicationQueriesSchemes</key> 59 <array> 60 <string>fbapi</string> 61 <string>fb-messenger-share-api</string> 62 <string>fbauth2</string> 63 <string>fbshareextension</string> 64 </array> 65</dict> 66</plist> 67

7'.サンプルソースコードを記述

// AppDelegate.m // sample // // #import "AppDelegate.h" #import <FBSDKCoreKit/FBSDKCoreKit.h> @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; // Add any custom logic here. return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey] ]; // Add any custom logic here. return handled; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end
// // ViewController.m // sample // // #import "ViewController.h" #import <FBSDKCoreKit/FBSDKCoreKit.h> #import <FBSDKLoginKit/FBSDKLoginKit.h> @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; // Optional: Place the button in the center of your view. loginButton.center = self.view.center; [self.view addSubview:loginButton]; } @end

クイックスタートガイドにはここまで記述した時点でログインが可能になると記載されていました。

また、クイックスタートガイドに、

4b.ビルド設定

XcodeのProject Navigatorにアクセスし、プロジェクトを選んでプロジェクト設定を見ます。
編集するために[Other Linker Flags]を選択します。
すべてのビルドターゲットに関して、フラグ-ObjCを[Other Linker Flags]に追加します。

 と記載がありましたが、既に先頭に-ObjCと表示があったので、何もしていません。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問