在Xamarin.forms项目中,我尝试使用下面的YML脚本创建构建。我添加了安装Appstore分发和APNS证书.p12文件的任务。整个脚本工作正常,构建工作正常,只有推送通知不工作,下面是我使用的脚本:
stage: iOSBuildProd
displayName: iOS Build Prod
dependsOn: iOSBuildQA
pool:
vmImage: 'macOS-latest'
jobs:
- job: iOSBuildSolution
displayName: iOS Build Solution
steps:
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_0_0
displayName: 'Select Xamarin SDK version'
enabled: false
- task: InstallAppleCertificate@2
displayName: installing Build certificate
inputs:
certSecureFile: '$(certAPNSFile)'
certPwd: '$(certificatePassword)'
keychain: 'temp'
deleteCert: true
- task: InstallAppleCertificate@2
displayName: installing Build certificate
inputs:
certSecureFile: '$(certDistributionFile)'
certPwd: '$(certificatePassword)'
keychain: 'temp'
deleteCert: true
- task: InstallAppleProvisioningProfile@1
displayName: installing provisioning profiles
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: $(AppStoreProfileName)
removeProfile: true
- task: NuGetToolInstaller@1
displayName: 'NuGet Installer'
- task: NuGetCommand@2
displayName: 'NuGet Command'
inputs:
restoreSolution: '$(solutionPath)'
- task: XamariniOS@2
displayName: 'iOS Build'
inputs:
solutionFile: '$(iOSSolutionPath)'
configuration: '$(solutionConfiguration)'
args: '/p:IpaPackageDir="$(outputDirectory)"'
packageApp: true
buildForSimulator: false
runNugetRestore: true
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
signingProvisioningProfileID: '$(APPLE_PROV_PROFILE_UUID)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(outputDirectory)'
ArtifactName: 'prodStage'
2条答案
按热度按时间r1zhe5dt1#
我是这样做的。这是行不通的,但我想分享一些代码。
p8h8hvxi2#
我最终使用Firebase.plugin for .Net Maui来解决这个问题。我不知道我发布的安装两个Apple Certificates的代码是否修复了它。我已经用我自己构建的APN服务器进行了测试,但仍然无法正常工作。因此,我使用Firebase来发送推送通知。
如果您在iOS上构建Firebase.plugin时遇到问题,请查看此问题。https://github.com/TobiasBuchholz/Plugin.Firebase/issues/51