maui icon indicating copy to clipboard operation
maui copied to clipboard

iOS Notification Service Extension Deploy Fails

Open borigas opened this issue 1 year ago • 5 comments

Description

I'm trying to add an iOS Notification Service Extension to my app, but I can't get it to deploy from VS. I am connected to a Mac and have a device selected.

------ Deploy started: Project: MauiDebugNotificationServiceExtension, Configuration: Release Any CPU ------
Please select a valid device before running the application.
Deploy failed
------ Deploy started: Project: MauiDebug, Configuration: Release Any CPU ------
Xamarin.iOS does not support deploying the previous version. Please ensure your solution builds before deploying it.
Deploy failed
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 2:19 PM and took 26.135 seconds ==========
========== Deploy: 0 succeeded, 2 failed, 0 skipped ==========
========== Deploy completed at 2:19 PM and took 26.135 seconds ==========

It looks like docs on how to use this haven't been done yet (https://github.com/dotnet/docs-maui/issues/1434). Instead, I referenced and tested a handful of 3rd party examples, but I get the same behavior. Examples referenced:

  • https://vladislavantonyuk.github.io/articles/Extend-.NET-MAUI-application-with-iOS-Extensions/
  • https://github.com/bitwarden/mobile/blob/main/src/iOS.Extension/iOS.Extension.csproj
  • https://github.com/OneSignal/OneSignal-DotNet-SDK/blob/4690aad1d54d7db8ee207da16027beaeba6ad6c7/Samples/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.csproj
  • https://github.com/exponea/bloomreach-maui-sdk/blob/main/ExamplePushServiceExtension/ExamplePushServiceExtension.csproj

Other things I've tried include:

  • Updating VS, XCode, dotnet, dotnet workloads
  • Rebooting Windows, Mac
  • Cleaning Windows, nuget package cache, Mac build cache, *.csproj.user
  • Deleting the connection to the Mac, disabling sharing on the Mac, enabling sharing on the Mac, recreating the connection
  • Deploying to different simulators/devices
  • Deploying to a local device with Hot Restart
  • Running mlaunch directly after building from VS:
    • /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8053/tools/bin/mlaunch --installdev ~/Library/Caches/Xamarin/mtbs/builds/MauiDebug/a30afb1d33bf5430897cbab9d42475927750458aadbcba47ce68f91a270a4fc6/bin/Release/net8.0-ios/iossimulator-arm64/MauiDebug.app --devname ocv6splus --wait-for-exit:false
      • Errors with error MT1006: Could not install the application '~/Library/Caches/Xamarin/mtbs/builds/MauiDebug/a30afb1d33bf5430897cbab9d42475927750458aadbcba47ce68f91a270a4fc6/bin/Release/net8.0-ios/iossimulator-arm64/MauiDebug.app' on the device 'ocv6splus': AMDeviceSecureInstallApplicationBundle returned: 0xe8008014
  • Building with dotnet build:
    • dotnet build -t:Run -f net8.0-ios -p:RuntimeIdentifier=ios-arm64 -p:_DeviceName="ocv6splus"
      • Errors with
      EXEC : error MT1006: Could not install the application 'bin/Debug/net8.0-ios/ios-arm64/MauiDebug.app/' on the device 'ocv6splus': AMDeviceSecureInstallApplicationBundle returned: 0xe800801c. [~/Repos/MauiDebug/MauiDebug.csproj]
      /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8053/targets/Xamarin.Shared.Sdk.targets(2068,3): error MSB3073: The command "/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8053/tools/bin/mlaunch --installdev bin/Debug/net8.0-ios/ios-arm64/MauiDebug.app/ --devname ocv6splus --wait-for-exit:false" exited with code 1. [~/Repos/MauiDebug/MauiDebug.csproj]
      

Steps to Reproduce

Try to run/deploy/debug from https://github.com/borigas/NotificationServiceExtensionRepro or any of the other examples mentioned above.

Or create a fresh Maui app with an iOS extension. To modify the Xamarin iOS extension to .NET 8, use this csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net8.0-ios</TargetFrameworks>
    <OutputType>Library</OutputType>

    <ApplicationId>MauiDebugNotificationServiceExtension</ApplicationId>

    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>

    <Nullable>enable</Nullable>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <ImplicitUsings>enable</ImplicitUsings>
    <SupportedOSPlatformVersion>15.4</SupportedOSPlatformVersion>
  </PropertyGroup>

  <PropertyGroup>
    <IsAppExtension>True</IsAppExtension>
    <IsWatchExtension>False</IsWatchExtension>
  </PropertyGroup>
</Project>

Link to public reproduction project repository

https://github.com/borigas/NotificationServiceExtensionRepro

Version with bug

8.0.21 SR4.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No, I have not been able to work around this problem. This is a blocker for me.

Relevant log output

No response

borigas avatar May 22 '24 20:05 borigas

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar May 22 '24 20:05 github-actions[bot]

Can repro this issue at iOS platform on the latest 17.11 Preview 1(8.0.40/8.0.21). https://github.com/borigas/NotificationServiceExtensionRepro

jaosnz-rep avatar May 23 '24 01:05 jaosnz-rep

Thanks for the issue report @borigas! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

Thanks for the issue report @borigas! This issue appears to be a problem with Visual Studio (Code), so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS (Code).

If you encounter a problem with Visual Studio or the .NET MAUI VS Code Extension, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or .NET MAUI VS Code Extension repository to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

I'm not convinced this is a problem with VS or VS Code. I can't deploy an iOS extension using VS, VS Code, dotnet run, or mlaunch. That said, I have created a feedback item at https://developercommunity.visualstudio.com/t/iOS-Notification-Service-Extension-Deplo/10665806 as well

borigas avatar May 23 '24 18:05 borigas

This is more likely an issue with the iOS SDK or the mlaunch tooling. Probably not directly IDE issues, but the people that fix deployment issues are the best. And since this is also VS and Pair to Mac, I am thinking this is best on that side.

I'm closing this one as you opened a new one in the developer community where IDE people live.

mattleibow avatar May 30 '24 17:05 mattleibow

It's been 3 weeks since I posted using the VS feedback tool but haven't seen any evidence that a human even read it. Are you sure the IDE folks are still there?

I also want to clarify from your previous post that this is not VS or Pair to Mac specific. It does fail from VS with Pair to Mac, but also fails from VS Code on a Mac, from dotnet run directly on a Mac, and from mlaunch directly on a Mac.

borigas avatar Jun 12 '24 15:06 borigas

We are also having this issue.

trampster avatar Jul 03 '24 02:07 trampster

My workaround so far is to make my reference to the iOS extension project have a condition so I can skip it when deploying from VS. At least that allows the rest of my app to deploy. Then my build server sets a property to enable the extension project so it gets packaged in the IPA. It makes for a pretty terrible dev loop, but at least it's possible to deploy the rest of my app again.

borigas avatar Jul 08 '24 17:07 borigas

I created https://github.com/xamarin/xamarin-macios/issues/20918 to see if they're able to offer insight. Visual Studio Developer Community doesn't seem to have anyone reading issues.

borigas avatar Jul 18 '24 21:07 borigas