Reputation: 21
I need to implement universal links in my Flutter application. I got everything to work on Android using the uni_links Flutter library, but on iOS I am facing some issues.
I followed these steps:
After following the steps I succeeded to run the iOS app locally in Xcode and the universal link seems to work. However, after deploying the iOS app works but clicking on a link opens the website and not our application. We are using Azure DevOps pipelines to publish our apps to MS App Center and eventually Testflight.
I believe that somehow the generated IPA does not contain the correct entitlements. Can someone help to fix our issue? Thank you in advance!
Our YAML build pipeline:
task: joachimdalen.env-transform.057845f0-8352-446f-a666-cb0e1f1055e3.EnvTransform@0 displayName: EnvTransform inputs: inputFile: '$(Build.SourcesDirectory)/[project]/assets/env/dotenv' outputFile: '$(Build.SourcesDirectory)/[project]/assets/env/dotenv'
task: InstallAppleProvisioningProfile@1 displayName: 'Install an Apple provisioning profile' inputs: provProfileSecureFile: '[GUID]'
task: InstallAppleCertificate@2 displayName: 'Install an Apple certificate' inputs: certSecureFile: '[GUID]' certPwd: '$(P12password)' setUpPartitionIdACLForPrivateKey: false
task: InstallAppleCertificate@2 displayName: 'Install an Apple certificate push' inputs: certSecureFile: '[GUID]' certPwd: '$(P12password)' setUpPartitionIdACLForPrivateKey: false
task: Hey24sheep.flutter.flutter-install.FlutterInstall@0 displayName: 'Flutter Install'
script: | echo "uninstalling all cocoapods versions" sudo gem uninstall cocoapods -ax echo "installing cocoapods version latest" sudo gem install cocoapods --pre workingDirectory: '$(build.sourcesdirectory)/[project]' displayName: 'Install cocoapods' enabled: false
task: Hey24sheep.flutter.flutter-build.FlutterBuild@0 displayName: 'Flutter Build iOS' inputs: target: ios projectDirectory: '$/[DIRECTORY]' verboseMode: true buildNumber: '$(build.buildNumber)' buildName: '$(build.buildNumber)' iosCodesign: false extraArgs: '--no-sound-null-safety'
task: DeleteFiles@1 displayName: 'Delete generated podfile' inputs: SourceFolder: '$(Build.SourcesDirectory)/[project]/ios/' Contents: Podfile
task: KirKone.fileoperations.rename.rename@0 displayName: 'Use our own special podfile ' inputs: SourceFile: '$(Build.SourcesDirectory)/[project]/ios/Podfile_replace' NewName: Podfile
script: |
cd ios/
pod repo update
pod install
cd ..
workingDirectory: '$(Build.SourcesDirectory)/[project]'
displayName: 'Install new pod'
task: Xcode@5 displayName: 'Xcode build' inputs: xcWorkspacePath: '**/Runner.xcworkspace' scheme: Runner packageApp: true exportPath: '$(System.ArtifactsDirectory)' exportOptions: plist exportOptionsPlist: '$[DIRECTORY]' exportArgs: '', signingOption: manual signingIdentity: 'iPhone Distribution' provisioningProfileUuid: '[PROVISIONING PROFILE]'
task: CopyFiles@2 displayName: 'Copy Files to: $(build.artifactstagingdirectory)' inputs: SourceFolder: '$(Build.SourcesDirectory)/[project]/ios/' TargetFolder: '$(build.artifactstagingdirectory)'
task: PublishPipelineArtifact@0 displayName: 'Publish Pipeline Artifact' inputs: artifactName: IOS targetPath: '$(build.artifactstagingdirectory)'
Our podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0' # required by simple_permission
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
end
UPDATE: It seems to be an issue in the Azure Pipeline (XCode successfully archived my project and I submitted the IPA to Testflight). I am now trying to archive an IPA in Azure DevOps by command line:
git clone https://github.com/flutter/flutter.git -b stable export PATH=$(build.sourcesdirectory)/[project\/flutter/bin:$PATH
echo "uninstalling all cocoapods versions"
sudo gem uninstall cocoapods -ax
echo "installing cocoapods version latest"
sudo gem install cocoapods --pre
echo "pod files"
flutter precache --ios
cd ios/
pod install --repo-update
cd ../ flutter
pub get
flutter build ios --no-codesign --build-name=$(build.buildNumber) --build-number=$(build.buildNumber) --verbose --no-sound-null-safety
xcodebuild -sdk iphoneos -configuration release -workspace /Users/runner/work/18/s/webdashboard/ios/Runner.xcworkspace -scheme Runner build CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY='iPhone Distribution' PROVISIONING_PROFILE=[profile] PROVISIONING_PROFILE_SPECIFIER= | /usr/local/lib/ruby/gems/2.7.0/bin/xcpretty -r junit --no-color
And now I'm receiving the following error:
/Users/runner/work/18/s/[project/ios/Runner/GeneratedPluginRegistrant.m:12:9: module 'share_plus' not found.
My pods folder is also empty.
Does anybody know what to do? I tried a lot of different commands.
Upvotes: 1
Views: 1497
Reputation: 17724
My guess is that the provision profile included in build pipeline doesn't have associated domain entitlement enabled
Upvotes: 1