Change CFBundleVersion from NotificationServiceExtension on flutter #66448 - ios

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 :)

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

ITSAppUsesNonExemptEncryption doesn't work in React Native App via Fastlane

Problem
Since a few weeks ago, I get asked for every uploaded build in iOS again for the Encryption information. I have specified in my info.plist via ITSAppUsesNonExemptEncryption that the app does not use encryption. Here is my Fastfile:
desc 'Push a new beta build to TestFlight'
lane :release do
increment
sync_code_signing(
type: 'appstore',
app_identifier: 'com.some.workplace'
)
build_app(scheme: 'app')
upload_to_testflight(
apple_id: apple_id,
itc_provider: team_id
)
end
Did Crapple change something? Do I have to specify something else in the Fastfile?

Fastlane upload fails: An attribute value is not acceptable for the current resource state. - The attribute 'versionString' can not be modified

I am trying to push a new build to the appstore.
But my fastlane build failed with this error message:
/Library/Ruby/Gems/2.6.0/gems/fastlane-2.204.3/spaceship/lib/spaceship/connect_api/api_client.rb:199:in
`handle_response': [!] An attribute value is not acceptable for the
current resource state. - The attribute 'versionString' can not be
modified. - /data/attributes/versionString
(Spaceship::UnexpectedResponse)
platform :ios do
desc "Push a new release build to the App Store"
lane :Runner do
increment_build_number(xcodeproj: "Runner.xcodeproj")
build_app(scheme: "Runner", silent: true)
upload_to_app_store
end
end
Turns out the problem was that that app isn't approved and released for the appstore yet.
So I can only upload it to TestFlight.
I needed to use upload_to_testflight fastlane
So the whole script in the Fastfile looks like:
platform :ios do
desc "Push a new release build to the App Store"
lane :Runner do
increment_build_number(xcodeproj: "Runner.xcodeproj")
build_app(scheme: "Runner", silent: true)
upload_to_testflight
end
end

error: exportArchive: Code signing "MyFramework.framework" failed in fastlane build

Archive succeeded but export failed through Fastlane build.
But the same export is working fine through Xcode because Xcode is not even asking for MyFrameworkIOS to sign.
I have two ways in mind to get this resolution:
How to avoid signing MyFrameworkIOS when building through fastlane in build machine? Because as you can see above, when building through xcode then MyFrameworkIOS signing is not required at all.
If we need to sign it then how to sign MyFrameworkIOS which is our own Framework created separately and being embedded in MyProject?
Fastfile:
default_platform(:ios)
platform :ios do
desc "Build the application"
lane :testflightbuild do
build_app(
scheme: "MyScheme",
workspace: "MyProject.xcworkspace",
export_method: "app-store",
export_options: {
},
include_bitcode: true
)
end
end
Thanks for helping in advance.

Could not find the IPA. Make sure you set the IPA path parameter to point to your IPA: in firebase distribution

[!] Could not find the IPA. Make sure you set the IPA path parameter to point to your IPA: (FastlaneCore::Interface::FastlaneCrash) in firebase distribution
My Fastfile:
default_platform(:ios)
platform :ios do
desc "Distribute to firebase"
lane :distribute do
# build_ios_app(...) # build_ios_app is a built-in fastlane action.
firebase_app_distribution(
app: "appid",
release_notes: "Lots of amazing new features to test out!"
)
end
end
I had this issue as well. Couldn't find an answer anywhere so thought I would throw this out there for others.
Looks like for me I had implemented it incorrectly.
Originally I did this:
lane :alpha do
match(type: "appstore")
cocoapods
firebase_app_distribution(
app: "...",
testers: "...",
release_notes_file: "/release-notes.txt"
)
end
You actually have to build the app though! So what it should look like is this:
(...'s are removed values)
lane :alpha do
match(type: "appstore")
cocoapods
build_app(workspace: "....xcworkspace", scheme: "...") <---- Add this line
firebase_app_distribution(
app: "...",
testers: "...",
release_notes_file: "/release-notes.txt"
)
end

Using fastlane with an app that uses a notification extension

I am using fastlane to build and send my app to testflight. This worked until I added a Notification Extension. Now it always gives me the error:
Error Domain=IDEProvisioningErrorDomain Code=9
""OneSignalNotificationServiceExtension.appex" requires a provisioning
profile with the App Groups feature."
UserInfo={NSLocalizedDescription="OneSignalNotificationServiceExtension.appex" requires a provisioning profile with the App Groups feature.,
NSLocalizedRecoverySuggestion=Add a profile to the
"provisioningProfiles" dictionary in your Export Options property
list.}
Everything is supposed to be handled automatically on Xcode, and my fastfile looks like this:
default_platform(:ios)
platform :ios do
before_all do
increment_build_number
end
desc "Push a new beta build to TestFlight"
lane :beta do
get_certificates # invokes cert
get_provisioning_profile # invokes sigh
build_app(workspace: "MyApp.xcworkspace", scheme: "MyApp (Production)")
pilot(skip_waiting_for_build_processing: true)
end
end
My bundle identifier for my app is like com.myapp.ios and my bundle identifier for my notification service is like com.myapp.ios.notificationservice.
I've tried creating multiple provisioning profiles for the different bundle identifiers manually, but fastlane only selects one. How can I fix this?
I fixed this by changing my manually specifying the provisioning profiles in my fastfile like this:
default_platform(:ios)
platform :ios do
before_all do
increment_build_number
end
desc "Push a new beta build to TestFlight"
lane :beta do
get_certificates # invokes cert
get_provisioning_profile # invokes sigh
build_app(workspace: "MyApp.xcworkspace",
scheme: "MyApp (Production)",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.myapp.ios" => "com.myapp.ios AppStore 1530397498",
"com.myapp.ios.OneSignalNotificationServiceExtension" => "MyApp Notification Extension Provisioning Profile"
}
})
pilot(skip_waiting_for_build_processing: true)
end
end
If you want to use match, you can replace export_options with this:
match(
app_identifier:["com.myapp.ios","com.myapp.ios.OneSignalNotificationServiceExtension"],
type: "appstore"
)

Resources