MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
274 stars 246 forks source link

iOS: OIDExternalUserAgent.h file not found #568

Closed jbnixdorf closed 1 week ago

jbnixdorf commented 2 weeks ago

Building my Flutter App with 7.0.1 is working fine but when upgrading the plugin to 8.0.0+1 the following error occurs when building iOS:

...

Running pod install...                                           1,340ms
Running Xcode build...                                                  
 └─Compiling, linking and signing...                      2,544ms
Xcode build done.                                           50.5s
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): 'OIDExternalUserAgent.h' file not found
/Users/dev/.pub-cache/hosted/pub.dev/flutter_appauth-8.0.0+1/ios/Classes/OIDExternalUserAgentIOSSafariViewController.h:18:8

Parse Issue (Xcode): Could not build module 'flutter_appauth'
/Users/dev/project/ios/Runner/GeneratedPluginRegistrant.m:15:8

Encountered error while building for device.

Building with latest Flutter (Channel stable, 3.24.4, on macOS 14.7.1 23H222 darwin-arm64, locale en-DE)

Can you help me to understand what I'm doing wrong or is this an issue of the plugin? Thanks!

MaikuB commented 1 week ago

Not absolutely certain on this one as I haven't run into the issue myself and plugin has been out for a while now that I would expect others to run into a similar issue. Furthermore, the repo makes use of GitHub actions to ensure that the example app can compile file and hasn't run into issues either.

I would guess it's there's an issue on your local environment.

@john-slow could the subtleties on having import statements using angle brackets vs quotation marks be the issue? I'm referring to code around here. I don't work in Objective-C but from what I know, quotation marks were more reserved for local files in the same package/app. Whilst it has worked for us, perhaps there are scenarios where this causes issues with some compilers?

john-slow commented 1 week ago

Not absolutely certain on this one as I haven't run into the issue myself and plugin has been out for a while now that I would expect others to run into a similar issue. Furthermore, the repo makes use of GitHub actions to ensure that the example app can compile file and hasn't run into issues either.

I would guess it's there's an issue on your local environment.

@john-slow could the subtleties on having import statements using angle brackets vs quotation marks be the issue? I'm referring to code around here. I don't work in Objective-C but from what I know, quotation marks were more reserved for local files in the same package/app. Whilst it has worked for us, perhaps there are scenarios where this causes issues with some compilers?

Yeah you are right, I believe that we use brackets for system framework import, and double quotations for local file import, so it should be good. We are using 8.0.0+1 right now in our project and never had this issue. @jbnixdorf have you tried to clean the cache? Or you may try to remove appauth package and reinstall it (make sure you clean the cache after you removed it).

jbnixdorf commented 1 week ago

I removed the plugin, cleaned the cache with flutter clean, deleted the Pods folder of the project and the .pub-cache in the user folder. Then I added the plugin again. I also rebooted my Mac and repeated the steps, but still the same error. Is there any another cache I could remove?

Shouldn't the file be in this folder? image

I'm working with Xcode 16.1 on macOS 14.7.1 (Sonoma)

john-slow commented 1 week ago

Are you working with Android Studio? If yes, try to invalidate caches of Android Studio. Try if this one would help: https://stackoverflow.com/questions/5198905/h-file-not-found

jbnixdorf commented 1 week ago

Android Studio is installed because it's needed for building the Android apk and aab. By the way that works fine but generally I do not open the project with Android Studio and it shouldn't be involved when building the iOS file. However, I invalidated the cache but as expected it did not change anything.

I also tried to clean and build with Xcode like suggested but I get the same error.

Should the missing file be in the folder of the screenshot above?

john-slow commented 1 week ago

Android Studio is installed because it's needed for building the Android apk and aab. By the way that works fine but generally I do not open the project with Android Studio and it shouldn't be involved when building the iOS file. However, I invalidated the cache but as expected it did not change anything.

I also tried to clean and build with Xcode like suggested but I get the same error.

Should the missing file be in the folder of the screenshot above?

No, I believe it comes from the AppAuth iOS package

Edit: I think the issue you have might not be related to the flutter_appauth package.

jbnixdorf commented 1 week ago

No, I believe it comes from the AppAuth iOS package

And this is downloaded as dependency, right? Can you tell me where this file should be placed on the build system? Somewhere in the pub.dev folder like the flutter_appauth package?

MaikuB commented 1 week ago

@jbnixdorf I suspect the change in https://github.com/MaikuB/flutter_appauth/tree/appauth-import would fix it. Are you able to have your app point to this to see if it fixes the issue before I see if I should publish the change? This page provides examples of how to reference via Git. Should be a harmless that I could publish anyway but prefer if you could test it first

jbnixdorf commented 1 week ago

Perfect, that fixed the issue for me! Because of company policies I'm not able to reference and download from github, but I checked your commits and replaced all three "OID..." imports with the import of "AppAuth.h". Then I'm able to build without issues.

Hope you have time to publish this change soon. Thank you very much for your help!