Afur / flutter_html_to_pdf

Flutter plugin for generating PDF files from HTML
MIT License
69 stars 126 forks source link

'flutter_html_to_pdf/flutter_html_to_pdf-Swift.h' file not found #2

Closed kevgug closed 5 years ago

kevgug commented 5 years ago

Plugin works great on android, but on iOS I get this message when trying to build:

screenshot 2019-02-11 at 21 01 40

Removing the library from my project built successfully, so there must definitely be an issue with this library. I have tried finding the 'flutter_html_to_pdf-Swift.h' file in my project, but am unable to. Any ideas would be great.

Thanks, Kevin

Afur commented 5 years ago

Hi, I am not able to reproduce your issue in my projects. Does this error also occur when you are trying to build an example project from this repository? Could you paste here build error message?

Thanks :)

kevgug commented 5 years ago

Hi, I think I have discovered something useful for this case.

1) First, here's my build error for my project:

Xcode build done.                                            5.9s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    === BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/xxx/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_html_to_pdf-0.3.0/ios/Classes/FlutterHtmlToPdfPlugin.m:2:9: fatal error: 'flutter_html_to_pdf/flutter_html_to_pdf-Swift.h' file not found
    #import <flutter_html_to_pdf/flutter_html_to_pdf-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone XR.
Exited (sigterm)

2) This didn't tell me much, so I tried using your example project. When debugging your example project, and referencing the package as

flutter_html_to_pdf:
    path: ../

it worked as expected.

When changing that reference in the example project to

flutter_html_to_pdf: ^0.3.0

however, I received this build error:

Xcode build done.                                           10.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    /Users/xxx/flutter_html_to_pdf/example/build/ios/Debug-iphonesimulator/Runner.app: resource fork, Finder information, or similar detritus not allowed
    Command /usr/bin/codesign failed with exit code 1
Could not build the application for the simulator.
Error launching application on iPhone XR.
Exited (sigterm)

It explains that some Swift code was deprecated. I'm guessing that should be quite easy to fix.

Hope this helps, Kevin

Afur commented 5 years ago

Hi Kevin, to avoid warnings change build settings as mentioned here

zjjt commented 5 years ago

Hi @Afur , i use your plugin in my app and it works flawlessly on android but i have the same error kevin had for the ios version. I tried doing what you suggested above but it's not working as it 's an error i get and not a warning.

Could you help me out please?

tagdev27 commented 4 years ago

This solution worked for me. Replace _#import <flutter_html_to_pdf/flutter_html_topdf-Swift.h> With _#import _