Solved

Flutter app won't build in iOS due to RevenueCat Pod issue

  • 26 October 2022
  • 1 reply
  • 652 views

Badge +4

Hi there! I'm having an issue with RevenueCat + CocoaPods when trying to build my Flutter app in Android Studio.

 

In Android Studio, I get the following error message:

 

Xcode build done.                                           18.0s
Failed to build iOS app
Error output from Xcode build:

    ** BUILD FAILED **


Xcode's output:

    Writing result bundle at path:
        /var/folders/s3/ghl3km215r790k4zktzbs0n00000gn/T/flutter_tools.CdsWMe/flutter_ios_build_temp_diricNjPw/temporary_xcresult_bundle

    /Users/javiernanni/StudioProjects/Respirar/ios/Pods/RevenueCat/Sources/LocalReceiptParsing/BasicTypes/AppleReceipt.swift:68:46: error: value of optional type 'String?' must be unwrapped to a value of type 'String'
            return (try? self.prettyPrintedJSON) ?? "<null>"
                                                 ^
    /Users/javiernanni/StudioProjects/Respirar/ios/Pods/RevenueCat/Sources/LocalReceiptParsing/BasicTypes/AppleReceipt.swift:68:46: note: coalesce using '??' to provide a default when the optional value contains 'nil'
            return (try? self.prettyPrintedJSON) ?? "<null>"
                                                 ^
                   (                                        ) ?? <#default value#>
    /Users/javiernanni/StudioProjects/Respirar/ios/Pods/RevenueCat/Sources/LocalReceiptParsing/BasicTypes/AppleReceipt.swift:68:46: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
            return (try? self.prettyPrintedJSON) ?? "<null>"
                                                 ^
                   (                                        )!
    note: Building targets in dependency order
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
        /var/folders/s3/ghl3km215r790k4zktzbs0n00000gn/T/flutter_tools.CdsWMe/flutter_ios_build_temp_diricNjPw/temporary_xcresult_bundle


Swift Compiler Error (Xcode): Value of optional type 'String?' must be unwrapped to a value of type 'String'
/Users/javiernanni/StudioProjects/Respirar/ios/Pods/RevenueCat/Sources/LocalReceiptParsing/BasicTypes/AppleReceipt.swift:67:45

Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).
 

 

This sounds weird, because if there's a bug in RevenueCat's Pod preventing the app to run, it should be affecting all other developers too, and this seems too obvious a bug to have slipped into production. But at the same time I can't figure out why this would be affecting me and no one else 🤔

 

Here's my Flutter Doctor output:

 

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.5.1 21G83 darwin-arm, locale en-ES)
    • Flutter version 2.10.4 at /Users/javiernanni/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (7 months ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/javiernanni/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.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 11.0.12+0-b1504.28-7817840)

[✓] Connected device (2 available)
    • iPhone SE (3rd generation) (mobile) • CCE6BC4C-0B26-4E82-BB0E-76522B77F76D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 106.0.5249.119

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

• No issues found!
Process finished with exit code 0

 

 

Also, I tried to zoom in on the error from XCode. See screenshot below:

 

I could try and fix this locally myself, but that doesn't feel right. Or is that what I'm supposed to do?

 

Thanks in advance for your help!

icon

Best answer by javiernanni 30 October 2022, 16:17

View original

1 reply

Badge +4

I was able to solve this, it was a config issue on my side. For some reason I can't remember, I had a line of code in my Pod file forcing it to build using Swift 4.2 (current version is 5.7 at time of writing). I deleted that line and it's now working fine.

Reply