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

IOS Build Failed #19

Open
amrLLSE opened this issue Jun 6, 2024 · 11 comments
Open

IOS Build Failed #19

amrLLSE opened this issue Jun 6, 2024 · 11 comments

Comments

@amrLLSE
Copy link

amrLLSE commented Jun 6, 2024

Hello

I'm facing this after installing the plugin to my project, I'm trying to migrate from zebrautility plugin to zsdk:

I'm already integrating the printer, now just refactoring to use ZSDK as I found that this will help me overcome some issues that I'm facing currently.

Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'ZebraPrinterConnection.h' file not found
/Users/username/.pub-cache/hosted/pub.dev/zsdk-3.2.0+3/ios/Classes/SGDParams.h:8:8

Lexical or Preprocessor Issue (Xcode): 'ZebraPrinterConnection.h' file not found
/Users/username/.pub-cache/hosted/pub.dev/zsdk-3.2.0+3/ios/Classes/PrinterConf.h:9:8

Lexical or Preprocessor Issue (Xcode): 'ZebraPrinterConnection.h' file not found
/Users/username/.pub-cache/hosted/pub.dev/zsdk-3.2.0+3/ios/Classes/PrinterSettings.h:8:8

When adding it to a fresh project, it builds successfully. Any ideas?

Thanks 🙏

@luis901101
Copy link
Owner

Hi, make sure your target Runner looks like the following in your project's Podfile:

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Then clean your project, make a pod repo-update and run again:

flutter clean
flutter pub get
cd ios/
rm Podfile.lock
pod install --repo-update
flutter run

@amrLLSE
Copy link
Author

amrLLSE commented Jun 7, 2024

Hi @luis901101
Thanks for your quick reply

Yes I have tried this and the target part is already in my Podfile as described by the plugin docs. Literally I have cleared everything and regenerated it but unfortunately does not help.

@luis901101
Copy link
Owner

Ok then, check that you are using the same IPHONEOS_DEPLOYMENT_TARGET in the whole project, I recommend you to set it to 13 or 14 (unless you need to support some old iOS version):

Check:

  1. ios/Flutter/AppFrameworkInfo.plist
<key>MinimumOSVersion</key>
<string>14.0</string>
  1. ios/Runner/Runner.xcodeproj/project.pbxproj (this is simpler by using Xcode UI)
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
  1. ios/Podfile
platform :ios, '14.0'

Also in the Podfile try with this in the post_install:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
      # whatever else you have here
    end
  end
end

after all of this it would be good to repeat the clean of the previous comment, also try with flutter pub upgrade instead of flutter pub get.


Try building your project for a Simulator as well as a physical device, and as a last resource I would recommend you to download the zsdk sample project and try to run it then compare it with your project.

I hope it helps.

@amrLLSE
Copy link
Author

amrLLSE commented Jun 7, 2024

Unfortunately still not working, I will do some more investigations and log the results here, if you have any other ideas let me know. Thanks so much for you support and great work 🙏

@luis901101
Copy link
Owner

Did you tried the las part of my previous comment:

Try building your project for a Simulator as well as a physical device, and as a last resource I would recommend you to download the zsdk sample project and try to run it then compare it with your project.

@amrLLSE
Copy link
Author

amrLLSE commented Jun 10, 2024

@luis901101 Yes, I found that some headers of the zsdk plugin are conflicting with other headers from other plugins, for example, the example project works well, but when adding zebrautility to this project it will not compile due to ZebraPrinterConnection.h file and some other header files with same name, also some plugins I'm using are internally using gRPC, it is conflicting with a file called Status.h (both plugins contain two header files with the same name).

@ziperjohn
Copy link

Hello,

I'm facing a similar situation as @amrLLSE this is my error:

Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside framework module 'zsdk.StatusUtils': '/Users/janvaverka/Developer/ASN Plus/Playground/zebra_app/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/Status.h'
/Users/janvaverka/.pub-cache/hosted/pub.dev/zsdk-3.2.0+3/ios/Classes/StatusUtils.h:8:8
StatusUtils.h:8

Lexical or Preprocessor Issue (Xcode): 'memory' file not found
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_app/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/grpc_audit_logging.h:23:9
grpc_audit_logging.h:23

Lexical or Preprocessor Issue (Xcode): 'algorithm' file not found
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_app/build/ios/Debug-iphoneos/abseil/absl.framework/Headers/algorithm/algorithm.h:24:9
algorithm.h:24

Parse Issue (Xcode): Could not build module 'grpc'
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_app/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/Status.h:21:9
Status.h:21

Parse Issue (Xcode): Could not build module 'zsdk'
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_app/ios/Runner/GeneratedPluginRegistrant.m:81:8

I found that this error only appears when I have added the zsdk and cloud_firestore packages to my project. When I remove one of them the error disappears. @amrLLSE did you manage to solve your error?

Any ideas how to solve it?

Thanks

@ziperjohn
Copy link

Hello,

i notice when i run pod install i have this warning

[!] A license was specified in podspec `zsdk` but the file does not exist - /Users/janvaverka/Developer/ASN Plus/Playground/test_zebra/ios/.symlinks/plugins/zsdk/ios/LICENSE

[!] Unable to read the license file `LICENSE` for the spec `zsdk (0.0.2)`

[!] Unable to read the license file `LICENSE` for the spec `zsdk (0.0.2)`

@amrLLSE
Copy link
Author

amrLLSE commented Jun 24, 2024

@ziperjohn So far no as I didn't have the time to do so, if I did later I will update the issue.

@ziperjohn
Copy link

Hello

@luis901101 you can take a look at my problem.

Steps to replicate the problem.

  1. Create new flutter project
  2. Add packages zsdk and cloud_firestore to pubspec.yaml
  3. Run app on ios device

I have spent the last day trying to solve this problem, with little success.

When I set Allow Non-modular Includes In Framework Modules to Yes in xcode, this error disappears:

Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside framework module 'zsdk.StatusUtils': '/Users/janvaverka/Developer/ASN Plus/Playground/zebra_app/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/Status.h'
/Users/janvaverka/.pub-cache/hosted/pub.dev/zsdk-3.2.0+3/ios/Classes/StatusUtils.h:8:8
StatusUtils.h:8

But these errors will remain:

Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'memory' file not found
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_print/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/grpc_audit_logging.h:23:9
grpc_audit_logging.h:23

Lexical or Preprocessor Issue (Xcode): 'algorithm' file not found
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_print/build/ios/Debug-iphoneos/abseil/absl.framework/Headers/algorithm/algorithm.h:24:9
algorithm.h:24

Parse Issue (Xcode): Could not build module 'grpc'
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_print/build/ios/Debug-iphoneos/gRPC-Core/grpc.framework/Headers/Status.h:21:9
Status.h:21

Parse Issue (Xcode): Could not build module 'zsdk'
/Users/janvaverka/Developer/ASN%20Plus/Playground/zebra_print/ios/Runner/GeneratedPluginRegistrant.m:21:8
GeneratedPluginRegistrant.m:21
2

Error launching application on Ziper.

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-CZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.90.2)
[✓] Connected device (5 available)
    ! Error: Browsing on the local area network for Ziper. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

Thanks for your effort

@ziperjohn
Copy link

Hello

Any progress @amrLLSE @luis901101 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants