Как исправить Flutter Firebase Google Authentication POD Ошибка установки?IOS

Программируем под IOS
Ответить
Anonymous
 Как исправить Flutter Firebase Google Authentication POD Ошибка установки?

Сообщение Anonymous »

Недавно я решил построить свое приложение в Flutter вместе с Firebase. После следования инструкциям все сработало. Тем не менее, проблема возникла, когда я решил добавить аутентификацию Google, которую предоставляет Firebase. Я заменил файл в папку iOS, и теперь я просто получаю ошибку: «Ошибка запуска установки POD. Ошибка запуска приложения на iPhone 16 Pro». Я нахожусь на M2 MacBook Pro и установил Ruby, как упомянуто в Docs. проблема. Я, вероятно, делаю что -то не так, но я не уверен, как это исправить. Любая помощь будет высоко оценена! П.с. Я сделал все шаги для соединения Firebase с трепеталом, включая регистрацию. /> Это мой полный код: < /p>
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
import 'package:google_fonts/google_fonts.dart'; // For modern typography
import 'package:firebase_auth/firebase_auth.dart';
// import 'package:cloud_firestore/cloud_firestore.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
textTheme: GoogleFonts.poppinsTextTheme(), // Modern typography
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
initialRoute: '/',
routes: {
'/': (context) => HomeScreen(),
'/login': (context) => LoginScreen(),
'/signup': (context) => SignUpScreen(),
'/mainMenu': (context) => MainMenu(),
},
);
}
}

class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Hi there! 👋',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(height: 40),
SleekButton(
text: 'Sign up',
color: Colors.blue,
onPressed: () {
Navigator.pushNamed(context, '/signup');
},
),
SizedBox(height: 20),
SleekButton(
text: 'Log in',
color: Colors.green,
onPressed: () {
Navigator.pushNamed(context, '/login');
},
),
SizedBox(height: 100),
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Lock in',
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.normal,
color: Colors.black,
),
),
),
],
),
),
),
);
}
}

class LoginScreen extends StatefulWidget {
@override
_LoginScreenState createState() => _LoginScreenState();
}

class _LoginScreenState extends State {
final _emailController = TextEditingController();
final _passwordController = TextEditingController();

Future _login() async {
try {
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: _emailController.text.trim(),
password: _passwordController.text.trim(),
);
Navigator.pushReplacementNamed(context, '/mainMenu');
} on FirebaseAuthException catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(e.message ?? 'An error occurred')));
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Welcome back! 👋',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(height: 20),
SleekTextField(hintText: 'Email', controller: _emailController),
SizedBox(height: 20),
SleekTextField(
hintText: 'Password',
obscureText: true,
controller: _passwordController,
),
SizedBox(height: 20),
SleekButton(
text: 'Log in',
color: Colors.green,
onPressed: _login,
),
SizedBox(height: 20),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
'Back',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black54,
),
),
),
],
),
),
),
);
}
}

class SignUpScreen extends StatefulWidget {
@override
_SignUpScreenState createState() => _SignUpScreenState();
}

class _SignUpScreenState extends State {
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
final _confirmPasswordController = TextEditingController();

Future _signUp() async {
if (_passwordController.text.trim() !=
_confirmPasswordController.text.trim()) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Passwords do not match')));
return;
}

try {
await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: _emailController.text.trim(),
password: _passwordController.text.trim(),
);
Navigator.pushReplacementNamed(context, '/mainMenu');
} on FirebaseAuthException catch (e) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(e.message ?? 'An error occurred')));
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Create an account 🚀',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(height: 20),
SleekTextField(hintText: 'Email', controller: _emailController),
SizedBox(height: 20),
SleekTextField(
hintText: 'Password',
obscureText: true,
controller: _passwordController,
),
SizedBox(height: 20),
SleekTextField(
hintText: 'Repeat Password',
obscureText: true,
controller: _confirmPasswordController,
),
SizedBox(height: 20),
SleekButton(
text: 'Sign up',
color: Colors.blue,
onPressed: _signUp,
),
SizedBox(height: 20),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
'Back',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black54,
),
),
),
],
),
),
),
);
}
}

class MainMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Welcome back! 👋',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(height: 40),
Card(
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: Container(
width: 363,
height: 254,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.lightBlueAccent],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(20),
),
child: Center(
child: Text(
"Your Content",
style: TextStyle(
fontSize: 22,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
SizedBox(height: 40),
AnimatedOpacity(
opacity: 1.0,
duration: Duration(seconds: 1),
child: Text(
'Lock in',
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.normal,
color: Colors.black,
),
),
),
],
),
),
),
);
}
}

class SleekButton extends StatelessWidget {
final String text;
final Color color;
final VoidCallback onPressed;

SleekButton({
required this.text,
required this.color,
required this.onPressed,
});

@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
width: double.infinity,
height: 60,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: color.withOpacity(0.3),
blurRadius: 10,
spreadRadius: 2,
offset: Offset(0, 4),
),
],
),
child: TextButton(
onPressed: onPressed,
child: Text(
text,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
);
}
}

class SleekTextField extends StatelessWidget {
final String hintText;
final bool obscureText;
final TextEditingController? controller;

SleekTextField({
required this.hintText,
this.obscureText = false,
this.controller,
});

@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
width: double.infinity,
height: 60,
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(15),
border: Border.all(color: Colors.grey[300]!),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: TextField(
controller: controller,
obscureText: obscureText,
decoration: InputDecoration(
hintText: hintText,
border: InputBorder.none,
),
),
),
);
}
}
< /code>
Это полная ошибка: < /p>
JSON::ParserError - Failed to parse JSON at file: ' / U s e r s / m a x i m n o t a / . c o c o a p o d s / r e p o s / t r u n k / S p e c s / c / 8 / 7 / g R P C - C + + / 1 . 6 5 . 6 - p r e 2 / g R P C - C + + . p o d s p e c . j s o n ' . < b r / > < b r / > u n e x p e c t e d t o k e n a t ' & q u o t ; s r c / c o r e / l ' < b r / > / o p t / h o m e b r e w / l i b / r u b y / g e m s / 3 . 4 . 0 / g e m s / c o c o a p o d s - c o r e - 1 . 1 6 . 2 / l i b / c o c o a p o d s - c o r e / s p e c i f i c a t i o n / j s o n . r b : 6 6 : i n ' P o d : : S p e c i f i c a t i o n . f r o m _ j s o n ' < b r / > / o p t / h o m e b r e w / l i b / r u b y / g e m s / 3 . 4 . 0 / g e m s / c o c o a p o d s - c o r e - 1 . 1 6 . 2 / l i b / c o c o a p o d s - c o r e / s p e c i f i c a t i o n . r b : 7 5 9 : i n ' P o d : : S p e c i f i c a t i o n . f r o m _ s t r i n g ' < b r / > / o p t / h o m e b r e w / l i b / r u b y / g e m s / 3 . 4 . 0 / g e m s / cocoapods-core-1.16.2/lib/cocoapods-core/specification.rb:733:in 'Pod::Specification.from_file'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-core-1.16.2/lib/cocoapods-core/source.rb:188:in 'Pod::Source#specification'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/resolver/lazy_specification.rb:37:in 'Pod::Specification::Set::LazySpecification#specification'
/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/delegate.rb:348:in 'block in delegating_block'
/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/delegate.rb:349:in 'block in delegating_block'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:178:in 'Pod::Resolver#dependencies_for'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:18:in 'block in Molinillo::Delegates::SpecificationProvider#dependencies_for'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in 'Molinillo::Delegates::SpecificationProvider#with_no_such_dependency_error_handling'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:17:in 'Molinillo::Delegates::SpecificationProvider#dependencies_for'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:809:in 'block in Molinillo::Resolver::Resolution#group_possibilities'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in 'Array#reverse_each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in 'Molinillo::Resolver::Resolution#group_possibilities'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:779:in 'Molinillo::Resolver::Resolution#possibilities_for_requirement'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:761:in 'Molinillo::Resolver::Resolution#push_state_for_requirements'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in 'Molinillo::Resolver::Resolution#require_nested_dependencies_for'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in 'Molinillo::Resolver::Resolution#activate_new_spec'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in 'Molinillo::Resolver::Resolution#attempt_to_activate'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in 'Molinillo::Resolver::Resolution#process_topmost_state'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in 'Molinillo::Resolver::Resolution#resolve'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in 'Molinillo::Resolver#resolve'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/resolver.rb:94:in 'Pod::Resolver#resolve'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:1082:in 'block in Pod::Installer::Analyzer#resolve_dependencies'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:64:in 'Pod::UserInterface.section'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:1080:in 'Pod::Installer::Analyzer#resolve_dependencies'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer/analyzer.rb:125:in 'Pod::Installer::Analyzer#analyze'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:422:in 'Pod::Installer#analyze'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:244:in 'block in Pod::Installer#resolve_dependencies'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:64:in 'Pod::UserInterface.section'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:243:in 'Pod::Installer#resolve_dependencies'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:162:in 'Pod::Installer#install!'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/command/install.rb:52:in 'Pod::Command::Install#run'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/claide-1.1.0/lib/claide/command.rb:334:in 'CLAide::Command.run'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/lib/cocoapods/command.rb:52:in 'Pod::Command.run'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/cocoapods-1.16.2/bin/pod:55:in ''
/opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/bin/pod:25:in 'Kernel#load'
/opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/bin/pod:25:in ''


Подробнее здесь: https://stackoverflow.com/questions/794 ... tall-error
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»