Change CFBundleVersion from NotificationServiceExtension on flutter #66448

Viewed 439

I have configured in my application OneSignal, so I need to create a Notification Service Extension on my iOS project.

The problem is that, when I publish my app on Apple Store, Im getting this error:

ITMS-90473: CFBundleVersion Mismatch - The CFBundleVersion value '15' of extension 'Runner.app/PlugIns/OneSignalNotificationServiceExtension.appex' does not match the CFBundleVersion value '147' of its containing iOS application 'Runner.app'.

Im building the project with FastLane, this is my publish script:

platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_number = number_of_commits(all: true)

    Dir.chdir ".." do
      sh("flutter", "packages", "get")
      sh("flutter", "clean")
      sh("flutter", "pub", "get")
      sh("flutter", "build", "ios", "--obfuscate", "--split-debug-info=logs", "--release", "-t", "lib/main_prod.dart", "--build-number=#{build_number}")
    end

    build_app(workspace: "Runner.xcworkspace", scheme: "Runner", export_method: 'app-store', silent: true)
    upload_to_testflight(skip_waiting_for_build_processing: true)
  end
end

My question is: What should I do to flutter build, change the CFBundleVersion from my ServiceExtension?

Thank you :)

1 Answers

This is what I do after doing a flutter build ios. Basically, I save the current version and build numbers, that was incremented already by flutter and pubspec.yaml, then use the increment scripts to force it on all targets and plists.

platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_number = get_build_number(xcodeproj: "Runner.xcodeproj")
    version_number = get_version_number(xcodeproj: "Runner.xcodeproj", target: 'Runner')
    increment_build_number(xcodeproj: "Runner.xcodeproj", build_number: build_number)
    increment_version_number(xcodeproj: "Runner.xcodeproj", version_number: version_number)
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
    upload_to_testflight
  end
end
Related