Skip to content

[Camera][ios]Adding camera plugin to a new flutter project, it does not build for ios. #126208

@DavidIjsud

Description

@DavidIjsud

Is there an existing issue for this?

Steps to reproduce

1.- Create a new flutter project
2.- Add camera plugin Camera
3.- f5 to run the app on ios emulator or real device

Expected results

The app launchs successfull on IOS

Actual results

When i press f5 to run the app it throws below message :

Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Xcode build done. 15.1s
Failed to build iOS app
Error output from Xcode build:

2023-05-06 17:45:29.707 xcodebuild[19891:98875] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
** BUILD FAILED **
Xcode's output:

Writing result bundle at path:
/var/folders/m8/cj3c72wd4wbgh3llqp79pn340000gn/T/flutter_tools.vFAudp/flutter_ios_build_temp_dirun4EC3/temporary_xcresult_bundle
mkdir -p /Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/camera_avfoundation/camera_avfoundation.framework" "/Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks"
building file list ... done
camera_avfoundation.framework/
camera_avfoundation.framework/Info.plist
camera_avfoundation.framework/camera_avfoundation
camera_avfoundation.framework/_CodeSignature/CodeResources
sent 516781 bytes received 92 bytes 1033746.00 bytes/sec
total size is 516354 speedup is 1.00
Stripped /Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/camera_avfoundation.framework/camera_avfoundation of architectures: arm64
Code Signing /Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/camera_avfoundation.framework with Identity -
/usr/bin/codesign --force --sign - --preserve-metadata=identifier,entitlements '/Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/camera_avfoundation.framework' &
/Users/user/Documents/david's things/projects/test_flutter_singular/test_singular_flutter/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: eval: line 174: unexpected EOF while looking for matching `''
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/m8/cj3c72wd4wbgh3llqp79pn340000gn/T/flutter_tools.vFAudp/flutter_ios_build_temp_dirun4EC3/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
I guess it would not be necessary due it is a new flutter project.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E772610a darwin-x64, locale en-US)
    • Flutter version 3.7.12 on channel stable at /Users/user/developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (3 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.78.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (3 available)
    • iPhone 14 Pro Max (mobile) • 383EEF0E-CDE3-4983-B531-A75EE58A9BEF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 13.3.1 22E772610a darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions