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

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

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

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Dart

Dartは、Googleによって開発されたJavaScriptの代替となることを目的に作られた、ウェブ向けのプログラミング言語である。

Q&A

0回答

859閲覧

FlutterでFirebaseを連携してiosで実行したい

takahiro00

総合スコア84

Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Dart

Dartは、Googleによって開発されたJavaScriptの代替となることを目的に作られた、ウェブ向けのプログラミング言語である。

0グッド

0クリップ

投稿2020/05/01 16:19

編集2020/05/01 17:00

前提・実現したいこと

FlutterでFirebaseを連携してiosで実行したいのですが、
エラーを吐いてしまいうまくいきません。

以下のサイトを参考にしてます。
参考
Firebaseにプロジェクトを作成して、バンドル IDを追加して
GoogleService-Info.plistをRunner/Runnerに格納して
pubspec.yamlに必要事項を追加したのですが、実行するとエラーになります。

ご教授お願い致します。

発生している問題・エラーメッセージ

Error output from Xcode build: ↳ 2020-05-02 01:06:54.357 xcodebuild[37114:14830530] DTDeviceKit: deviceType from 1b505360927b73b006abf749ee33c17fe0229f3d was NULL ** BUILD FAILED ** Xcode's output: ↳ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.3.0+1/ios/Classes/GoogleSignInPlugin.m:138:41: warning: 'UIApplicationOpenURLOptionsSourceApplicationKey' is only available on iOS 9.0 or newer [-Wunguarded-availability] NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'UIKit' imported from /Users/tetetete/my_app/ios/Pods/Target Support Files/google_sign_in/google_sign_in-prefix.pch:2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:518:51: note: 'UIApplicationOpenURLOptionsSourceApplicationKey' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0 UIKIT_EXTERN UIApplicationOpenURLOptionsKey const UIApplicationOpenURLOptionsSourceApplicationKey NS_SWIFT_NAME(sourceApplication) API_AVAILABLE(ios(9.0)); // value is an NSString containing the bundle ID of the originating application; non-nil if the originating application and this application share the same team identifier ^ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.3.0+1/ios/Classes/GoogleSignInPlugin.m:138:41: note: enclose 'UIApplicationOpenURLOptionsSourceApplicationKey' in an @available check to silence this warning NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.3.0+1/ios/Classes/GoogleSignInPlugin.m:139:27: warning: 'UIApplicationOpenURLOptionsAnnotationKey' is only available on iOS 9.0 or newer [-Wunguarded-availability] id annotation = options[UIApplicationOpenURLOptionsAnnotationKey]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'UIKit' imported from /Users/tetetete/my_app/ios/Pods/Target Support Files/google_sign_in/google_sign_in-prefix.pch:2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:519:51: note: 'UIApplicationOpenURLOptionsAnnotationKey' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0 UIKIT_EXTERN UIApplicationOpenURLOptionsKey const UIApplicationOpenURLOptionsAnnotationKey NS_SWIFT_NAME(annotation) API_AVAILABLE(ios(9.0)); // value is a property-list typed object corresponding to what the originating application passed in UIDocumentInteractionController's annotation property ^ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.3.0+1/ios/Classes/GoogleSignInPlugin.m:139:27: note: enclose 'UIApplicationOpenURLOptionsAnnotationKey' in an @available check to silence this warning id annotation = options[UIApplicationOpenURLOptionsAnnotationKey]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/ios/Classes/FirebaseCorePlugin.m:13:17: warning: property 'dictionary' requires method 'dictionary' to be defined - use @dynamic or provide a method implementation in this category [-Wobjc-property-implementation] @implementation FIROptions (FLTFirebaseCorePlugin) ^ ^ ~~~~~~~~~~~~省略~~~~~~~~~~~~ ^ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.6/ios/Classes/FirebaseAuthPlugin.m:235:67: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)') completion:^(FIRUser *user, NSError *error) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /Users/tetetete/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.6/ios/Classes/FirebaseAuthPlugin.m:392:62: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] userData[@"lastSignInTimestamp"] = [NSNumber numberWithInt:lastSignInDate]; ~ ^~~~~~~~~~~~~~ 2 warnings and 15 errors generated. note: Using new build system note: Planning build note: Constructing build description Could not build the application for the simulator. Error launching application on iPhone 11 Pro Max.

該当のソースコード

android/build.gradleに追記

dependencies { classpath 'com.google.gms:google-services:3.2.1' classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }

pubspec.yamlに追記

dependencies: flutter: sdk: flutter firebase_core: ^0.2.5 # add dependency for Firebase Core firebase_auth: ^0.6.6 google_sign_in: ^3.2.4

Dart

1import 'package:firebase_auth/firebase_auth.dart'; 2import 'package:flutter/material.dart'; 3import 'package:google_sign_in/google_sign_in.dart'; 4 5void main() => runApp(MyApp()); 6 7class MyApp extends StatelessWidget { 8 9 Widget build(BuildContext context) { 10 return MaterialApp( 11 title: 'Flutter × firebase Demo', 12 theme: ThemeData( 13 primarySwatch: Colors.blue, 14 ), 15 home: MyHomePage(title: 'Flutter × firebase Demor'), 16 ); 17 } 18} 19 20class MyHomePage extends StatefulWidget { 21 MyHomePage({Key key, this.title}) : super(key: key); 22 23 final String title; 24 25 26 _MyHomePageState createState() => _MyHomePageState(); 27} 28 29class _MyHomePageState extends State<MyHomePage> { 30 FirebaseUser _user; 31 32 void _setUser(FirebaseUser user) { 33 setState(() { 34 _user = user; 35 }); 36 } 37 38 final GoogleSignIn _googleSignIn = GoogleSignIn(); 39 final FirebaseAuth _auth = FirebaseAuth.instance; 40 41 Future<FirebaseUser> _handleSignIn() async { 42 GoogleSignInAccount googleUser = await _googleSignIn.signIn(); 43 GoogleSignInAuthentication googleAuth = await googleUser.authentication; 44 FirebaseUser user = await _auth.signInWithGoogle( 45 accessToken: googleAuth.accessToken, 46 idToken: googleAuth.idToken, 47 ); 48 print("signed in " + user.displayName); 49 return user; 50 } 51 52 53 Widget build(BuildContext context) { 54 return Scaffold( 55 appBar: AppBar( 56 title: Text(widget.title), 57 ), 58 body: _user == null ? googleAuthBtn() : chat()); 59 } 60 61 Widget googleAuthBtn() { 62 return Center( 63 child: Column( 64 mainAxisAlignment: MainAxisAlignment.center, 65 children: <Widget>[ 66 FlatButton( 67 padding: EdgeInsets.all(20.0), 68 color: Colors.grey, 69 onPressed: () { 70 _handleSignIn() 71 .then((FirebaseUser user) => _setUser(user)) 72 .catchError((e) => print(e)); 73 }, 74 child: Text('google認証'), 75 ), 76 ], 77 ), 78 ); 79 } 80 81 Widget chat() { 82 return Center( 83 child: Column( 84 mainAxisAlignment: MainAxisAlignment.center, 85 children: <Widget>[Text('chat')], 86 ), 87 ); 88 } 89} 90

試したこと

pod setup
flutter clean
flutter run
上記コマンドは打ちましたがダメでした。

バージョン

Xcode Version 11.3.1 (11C504)

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問