Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileUtils.h can't be parsed #1454

Closed
1 of 4 tasks
JHarzenetter opened this issue Mar 6, 2024 · 9 comments
Closed
1 of 4 tasks

FileUtils.h can't be parsed #1454

JHarzenetter opened this issue Mar 6, 2024 · 9 comments
Labels
iOS Issue applies to iOS platform triage Further information is requested

Comments

@JHarzenetter
Copy link

App is started via: flutter run and its terminated with following exception:

Could not build the precompiled application for the device.
Parse Issue (Xcode): Expected identifier /Users/jharzenetter/.pub-cache/hosted/pub.dev/file_picker-6.2.0/ios/Classes/FileUtils.h:18:2

Error launching application

Platform

  • Android
  • iOS
  • Web
  • Desktop

Platform OS version
OS: macOS Sonoma 14.3.1
Target: iOS 17.3.1

Details to reproduce the issue
flutter run with App referring to this Plugin

Error Log
output of flutter run -v

[  +15 ms] Failed to build iOS app
[        ] Could not build the precompiled application for the device.
[   +2 ms] Parse Issue (Xcode): Expected identifier
           /Users/jharzenetter/.pub-cache/hosted/pub.dev/file_picker-6.2.0/ios/Classes/FileUtils.h:18:2
           
[        ] Error launching application on iPhone von Johannes.
[   +2 ms] "flutter run" took 16.225ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:815:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1389:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

Flutter Version details
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.3.1 23D60 darwin-arm64, locale de-DE)
• Flutter version 3.19.2 on channel stable at /Users/jharzenetter/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7482962148 (8 days ago), 2024-02-27 16:51:22 -0500
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/jharzenetter/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A507
• CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2023.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.9+0-17.0.9b1087.7-11185874)

[✓] Connected device (2 available)
• iPhone von Johannes (mobile) • 00008101-00114DCA21E3001E • ios • iOS 17.3.1 21D61
• macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64
! Device R5CW81D0N9X is not authorized.
You might need to check your device for an authorization dialog.

[✓] Network resources
• All expected network resources are available.

@JHarzenetter JHarzenetter added the new issue An issue that hasn't yet been seen from the maintainer label Mar 6, 2024
@JHarzenetter JHarzenetter changed the title FileUtils.h can't be Parsed FileUtils.h can't be parsed Mar 6, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Mar 14, 2024
@miguelpruivo
Copy link
Owner

Have you managed to fix it?

@miguelpruivo miguelpruivo added triage Further information is requested iOS Issue applies to iOS platform and removed new issue An issue that hasn't yet been seen from the maintainer stale labels Mar 20, 2024
@JHarzenetter
Copy link
Author

I haven't tried because i dont understand anything from Header Files

@miguelpruivo
Copy link
Owner

Closing as this might have been a temporary issue — will re-open if it gains relevance.

@JHarzenetter
Copy link
Author

JHarzenetter commented Apr 15, 2024

@miguelpruivo
I cant help but the issue still exists on my side... Even with Version 8.0.0

If anyone has an idea how to fix this (looks like its only happening for me) otherwise the issue would have risen by far more people.

I tried cleaning the pub cache, rebuild everything but it seems like nothing helps.

file_Picker-Version ^8.0.0
Flutter-Doctor-Output:

✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale de-DE)
    • Flutter version 3.19.5 on channel stable at /Users/jharzenetter/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1


[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/jharzenetter/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.


[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2


[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google
    Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.


[✓] Android Studio (version 2023.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.9+0-17.0.9b1087.7-11185874)


[✓] Connected device (2 available)
    • iPhone von Johannes (mobile)  • iOS 17.3.1 21D61
    • macOS (desktop)              • macos                     • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64


[✓] Network resources
    • All expected network resources are available.

@JHarzenetter
Copy link
Author

JHarzenetter commented Apr 15, 2024

Content of FileUtils.h from my pub-cache

//
//  FileUtils.h
//  Pods
//
//  Created by Miguel Ruivo on 05/12/2018.
//
#import <MobileCoreServices/MobileCoreServices.h>
#import <Photos/Photos.h>

#ifdef DEBUG
#define Log(fmt, ...)            NSLog((@"\n\n***** " fmt @"\n* %s [Line %d]\n\n\n"), ##__VA_ARGS__, __PRETTY_FUNCTION__, __LINE__)
#else
#define Log(fmt, ...)
#endif

typedef NS_ENUM(NSInteger, MediaType) {
  VIDEO,
  IMAGE,
  MEDIA
};

@interface FileUtils : NSObject
+ (BOOL) clearTemporaryFiles;
+ (NSArray<NSString*>*) resolveType:(NSString*)type withAllowedExtensions:(NSArray<NSString*>*)allowedExtensions;
+ (MediaType) resolveMediaType:(NSString*)type;
+ (NSArray<NSDictionary*>*) resolveFileInfo:(NSArray<NSURL *> *)urls withData:(BOOL)loadData;
+ (NSURL*) exportMusicAsset:(NSString*)url withName: (NSString*)name;
@end

@JHarzenetter
Copy link
Author

JHarzenetter commented Apr 15, 2024

Verbose Error-Message from building

[  +18 ms] Failed to build iOS app
[  +45 ms] Parse Issue (Xcode): Expected identifier
           /Users/jharzenetter/.pub-cache/hosted/pub.dev/file_picker-8.0.0+1/ios/Classes/FileUtils.h:18:2
           
[   +2 ms] "flutter ipa" took 24.993ms.
[   +4 ms] Encountered error while archiving for device.
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:680:7)
           <asynchronous suspension>
           #2      BuildIOSArchiveCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:425:50)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1389:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #5      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
           <asynchronous suspension>
           #9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #11     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

@JHarzenetter
Copy link
Author

@miguelpruivo ive managed to locate the source: it's the enumType MEDIA. I dont know why or how but if i change the name of the last enumtype everything works fine. I dont really know which sideeffects this has but this works for me now. (I guess there aren't that many bc it compiles)

Maybe its something with an other library which causes this error but i could not find anything

@zontag
Copy link

zontag commented Aug 28, 2024

From my side, the issue was on podfile:

target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        ## dart: PermissionGroup.camera
        'PERMISSION_CAMERA=1',
        # dart: PermissionGroup. photos
        'PERMISSION_PHOTOS=1',
        'PERMISSION_PHOTOS_ADD_ONLY=1',
        # dart: PermissionGroup.mediaLibrary
        'PERMISSION_MEDIA_LIBRARY=1' 
      ]
    end

The 'PERMISSION_MEDIA_LIBRARY=1' was 'PERMISSION MEDIA LIBRARY=1' causing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issue applies to iOS platform triage Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants