You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this happened to me when path(AdditionalAppExtensions Include + BuildOutput), didn't point to the widget which xcode built. Haven't tried it on windows yet, so @dajbych your issue could be something else.
Hi @chamons thanks for your work with this. I created a draft PR to get the sample compiling in Xcode 12 GM. However building the Xamarin iOS app with the widget in Visual Studio is impossible for me atm, due to the ditto compile error.
@t9mike - Not easily. The WidgetKit extension is in a separate process space than your main application, and can be invoked arbitrarily by Apple to get more timeline data.
It would be theoretically possible to use something like https://github.com/mono/Embeddinator-4000 to start up mono and then invoke C#, but that project has been in community support for awhile and isn't in the best shape today.
Due to this, I believe the best approach is to either serialize data in your application (or background task) to a common location (what the sample does) or fetch the data from a shared web service.
Thanks for the great demo app Chris!
Based on your example, I managed to create a widget extension for my app, using group identifiers.
All is working just fine in the simulator. Also, running directly from Xcode (swiftUI) on a real device works great.
When I run the app from VS for Mac however (hybrid mode) on a real device, I get following error in the console log of the device:
container_create_or_lookup_path_for_platform: client is not entitled
container_create_or_lookup_app_group_path_by_app_group_identifier: client is not entitled
I did include all group entitlements and also registered them at Apple Developer account..
Any idea what I'm missing?
Thanks!
I've cloned the sample repo and replaced certificates and provisioning profiles with mine. Here are my current experience with the sample, which is not very good so far:
I do not understand how the Swift UI App could share the same bundle ID with the Xamarin App. Is this because in the end it will not, given the fact that the Xamarin App embed only the widget ?
How can I debug such an hybrid app ? At this time I can't install the Xamarin App alone on the device. The message states that its integrity could not be verified.
I can install the SwiftUIApp with its Widget first, then the Xamarin App. In this scenario, it works.
But from now if I start the application from Visual Studio, this is the SwiftUIApp that is launched not he Xamarin one.
And last but not least, Xamarin asks me to launch the app in debug mode because it is signed with a distribution profile, which is not true, I'm using a developer profile.
I also have this warning
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Warning: The App Extension 'NativeWidget' has an unrecognized NSExtensionPointIdentifier value ('com.apple.widgetkit-extension').
(TestApplication)
I am not having these problems with the simulator (iPhone 14/ iOS 16).
Is there any official support coming for this? If an app built with Xamarin wants to make a Live Activity (Xcode 14.1), simply put, you can't because it requires the UI to be made with SwiftUI and WidgetKit. I know that others have suggested some workarounds but there isn't any official support for WidgetKit provided by or approved by Microsoft.
I didn't see any mention of ActivityKit in the Xcode 14.1 milestone.
@SwiftNativeDeveloper I don't think that Xamarin will ever get support for features related to SwiftUI. That's the problem with cross-platform technologies, they sometimes hit the wall. In terms of Xamarin, I think it would be pretty hard to apply their current approach to SwiftUI. That's why nothing happens in this matter and no official news appears.
The only hope is to write some code natively and try to combine it with the current Xamarin app.
I have tried this so far and it seems to work quite well. However, if I want to create a configurable widget, the configuration.intent file must contain the target of the main app in Xcode (see https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget).
This doesn't seem to work with Xamarin, and the widgets configuration is not working properly (no entry fields are shown and an error "unable to load" appears).
Is there a trick or an idea for this?
I have tried this so far and it seems to work quite well. However, if I want to create a configurable widget, the configuration.intent file must contain the target of the main app in Xcode (see https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget). This doesn't seem to work with Xamarin, and the widgets configuration is not working properly (no entry fields are shown and an error "unable to load" appears). Is there a trick or an idea for this?
I'm also wondering how to create a configurable widget. I was able to get something working natively, but when I load the widget Xamarin Forms the configuration doesn't work. I get a similar 'Unable to load' message.
@martic224@netzperfekt Not sure how helpful this is, but I've had an Intents extension working as configuration for a widget in a production app for a while across many builds (the app itself is Xamarin Forms, and I have extensions for the widget, intents, and watch on iOS). It was actually pretty straightforward to add -- it just needs to be another AdditionalAppExtension in the .csproj file.
Here's the relevant section of my .csproj with the project names replaced, in case it's helpful (which is really the same as the widget extension):
I would think if the intent works fine when you debug it/the widget from Xcode, that just bundling it into your Xamarin build with AdditionalAppExtensions should work OK, but maybe there's a step I did that I'm not realizing. I didn't try to package my main stub Swift app into the intents extension or anything like that.
(As an aside, with more stuff I've added to extensions over time, I've also had to add too much "bridge" code where I basically have much of the "same" code written in C#/XAML and Swift/SwiftUI at the same time to display the same things in Xamarin and in SwiftUI. I'm currently working on replacing my main Xamarin app with a native Swift app on iOS/iPadOS, but YMMV and your approach may vary.)
@adam-russell I did try adding an additional app extension block but that didn't work for me.
I think it's because in Xcode I can set the widget.intentdefinition to be a Target Member of the native app and widget but I haven't found a way to do that nicely in Xamarin forms.
Do you have any other tips?
Edit:
I got it working finally. I added the intentdefinition file as a link to my Xamarin forms ios project in the reference folder and set the Build Action to 'EmbeddedResource'.
And as Adam stated above, you need another AdditionalAppExtentsions block for the intent project.
FYI, in case this is also helpful, my .intentdefinition is not in the main app in the packaged IPA that I can see. It's in both my widget .appex and my intents .appex, though, which are both in the PlugIns folder inside the IPA.
Hi guys, it's my first time writing a Widget in iOS and I'm facing the same difficulties of @martic224 and @netzperfekt.
Since some of you managed to make it work, could you please share a sample project or something similar to a guide?
It would really help a lot.
Unzip and run the run_app.sh script. It should build the app and deploy to your simulator. You will have to setup the Xcode project, signing, certificates etc. if you want to run it on a physical device or publish the app.
I haven't released an app with a widget extension to the store myself, so maybe there are problems that I haven't encountered yet
@tipa I finally managed to try your project and after some modifications it worked, thank you so much!
what type of modifications you made? I'm wasting so many hours.. I signed everything correctly and changed bundleId/applicationId..
I think the issue could be the path but don't understand I should set it, I left it how it was in the @tipa project. It gives me MSB6006 "ditto" error like someone experienced.
@tipa thanks a lot, it was a lifesaver after many hours of struggle with configs. In the past, Message stickers worked well from a .csproj, but something broke lately. So I configured them from Xcode and added as a native project.
Ended up moving the contents of run_app.sh into iOS .csproj and now it runs from Rider too, both on simulator and device:
Activity
chamons commentedon Sep 16, 2020
Just an update on this - direct support for WidgetKit in C# did not make it this year, and isn't in our initial Xcode 12 support release.
However, we did add support for using a new AdditionalAppExtensions property in your project to embed Swift extensions in your Xamarin.iOS project.
More complete support is on our backlog for future possible features now.
chamons commentedon Sep 16, 2020
See the PR for an example. More details in a future blog post as well.
mobilinked commentedon Sep 21, 2020
@chamons
Thank you for the update. If it's convenient, can Xamarin team share us a simple guide from project setting up to release to App Store?
And another idea related to the tech you are using:
Best Regards,
Philip
programmation commentedon Sep 22, 2020
I downloaded the sample app from https://github.com/chamons/xamarin-ios-swift-extension/blob/master/App/TestApplication/TestApplication.csproj#L143 but the demo Extension doesn't compile with Xcode 12 GM.
dajbych commentedon Sep 22, 2020
Same problem here. Visual Studio 2019 version 16.7.4 ends the build with the following error:
"ditto" exited with code 1.Csaba8472 commentedon Sep 22, 2020
this happened to me when path(AdditionalAppExtensions Include + BuildOutput), didn't point to the widget which xcode built. Haven't tried it on windows yet, so @dajbych your issue could be something else.
chamons commentedon Sep 22, 2020
@programmation (and others here) - Please post a full build log
michaeldimoudis commentedon Sep 23, 2020
Hi @chamons thanks for your work with this. I created a draft PR to get the sample compiling in Xcode 12 GM. However building the Xamarin iOS app with the widget in Visual Studio is impossible for me atm, due to the
dittocompile error.The PR is here: chamons/xamarin-ios-swift-extension#1
Cheers
chamons commentedon Sep 23, 2020
Love the PR, it does not surprise me that Apple broke the Widget after the Beta I wrote that in.
michaeldimoudis commentedon Sep 23, 2020
Above PR is updated and merged, everything is working in Visual Studio now, no more
"ditto" exited with code 1error. Thanks @chamons!t9mike commentedon Sep 24, 2020
Is it possible to make an API call into my Xamarin phone app from the Swift widget to get data to display?
chamons commentedon Sep 24, 2020
@t9mike - Not easily. The WidgetKit extension is in a separate process space than your main application, and can be invoked arbitrarily by Apple to get more timeline data.
It would be theoretically possible to use something like https://github.com/mono/Embeddinator-4000 to start up mono and then invoke C#, but that project has been in community support for awhile and isn't in the best shape today.
Due to this, I believe the best approach is to either serialize data in your application (or background task) to a common location (what the sample does) or fetch the data from a shared web service.
lunoit commentedon Sep 26, 2020
Thanks for the great demo app Chris!
Based on your example, I managed to create a widget extension for my app, using group identifiers.
All is working just fine in the simulator. Also, running directly from Xcode (swiftUI) on a real device works great.
When I run the app from VS for Mac however (hybrid mode) on a real device, I get following error in the console log of the device:
container_create_or_lookup_path_for_platform: client is not entitled
container_create_or_lookup_app_group_path_by_app_group_identifier: client is not entitled
I did include all group entitlements and also registered them at Apple Developer account..
Any idea what I'm missing?
Thanks!
45 remaining items
omatrot commentedon Oct 18, 2022
Hello everyone.
I just discovered the WidgetKit support in Xamario.iOS and would like to build and app starting with the sample.
My Setup is a MacBook Pro M1 with Xcode and VS 2022 and an iPhone 8 Plus (iOS 16).
I've cloned the sample repo and replaced certificates and provisioning profiles with mine. Here are my current experience with the sample, which is not very good so far:
I also have this warning
I am not having these problems with the simulator (iPhone 14/ iOS 16).
Which would indicate that Code signing is broken again ? Should I reopen https://github.com/xamarin/xamarin-macios/issues/15598 ?
Any help appreciated.
SwiftNativeDeveloper commentedon Nov 10, 2022
Is there any official support coming for this? If an app built with Xamarin wants to make a Live Activity (Xcode 14.1), simply put, you can't because it requires the UI to be made with SwiftUI and WidgetKit. I know that others have suggested some workarounds but there isn't any official support for WidgetKit provided by or approved by Microsoft.
I didn't see any mention of ActivityKit in the Xcode 14.1 milestone.
https://developer.apple.com/documentation/activitykit
This translates to zero support for the new Dynamic Island hardware feature available in iPhone 14 Pro / Pro Max.
wojciech-kulik commentedon Nov 11, 2022
@SwiftNativeDeveloper I don't think that Xamarin will ever get support for features related to SwiftUI. That's the problem with cross-platform technologies, they sometimes hit the wall. In terms of Xamarin, I think it would be pretty hard to apply their current approach to SwiftUI. That's why nothing happens in this matter and no official news appears.
The only hope is to write some code natively and try to combine it with the current Xamarin app.
netzperfekt commentedon Jan 24, 2023
I have tried this so far and it seems to work quite well. However, if I want to create a configurable widget, the configuration.intent file must contain the target of the main app in Xcode (see https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget).
This doesn't seem to work with Xamarin, and the widgets configuration is not working properly (no entry fields are shown and an error "unable to load" appears).
Is there a trick or an idea for this?
martic224 commentedon Mar 2, 2023
I'm also wondering how to create a configurable widget. I was able to get something working natively, but when I load the widget Xamarin Forms the configuration doesn't work. I get a similar 'Unable to load' message.
adam-russell commentedon Mar 2, 2023
@martic224 @netzperfekt Not sure how helpful this is, but I've had an Intents extension working as configuration for a widget in a production app for a while across many builds (the app itself is Xamarin Forms, and I have extensions for the widget, intents, and watch on iOS). It was actually pretty straightforward to add -- it just needs to be another AdditionalAppExtension in the .csproj file.
Here's the relevant section of my .csproj with the project names replaced, in case it's helpful (which is really the same as the widget extension):
<AdditionalAppExtensions Include="$(MSBuildProjectDirectory)/../ProjectPath"> <Name>ProjectIntentsExtension</Name> <BuildOutput Condition="'$(Platform)' == 'iPhone'">build/Release-iphoneos</BuildOutput> <BuildOutput Condition="'$(Platform)' == 'iPhoneSimulator'">DerivedData/ProjectPath/Build/Products/Debug-iphonesimulator</BuildOutput> </AdditionalAppExtensions>I would think if the intent works fine when you debug it/the widget from Xcode, that just bundling it into your Xamarin build with
AdditionalAppExtensionsshould work OK, but maybe there's a step I did that I'm not realizing. I didn't try to package my main stub Swift app into the intents extension or anything like that.(As an aside, with more stuff I've added to extensions over time, I've also had to add too much "bridge" code where I basically have much of the "same" code written in C#/XAML and Swift/SwiftUI at the same time to display the same things in Xamarin and in SwiftUI. I'm currently working on replacing my main Xamarin app with a native Swift app on iOS/iPadOS, but YMMV and your approach may vary.)
martic224 commentedon Mar 2, 2023
@adam-russell I did try adding an additional app extension block but that didn't work for me.
I think it's because in Xcode I can set the
widget.intentdefinitionto be a Target Member of the native app and widget but I haven't found a way to do that nicely in Xamarin forms.Do you have any other tips?
Edit:
I got it working finally. I added the intentdefinition file as a link to my Xamarin forms ios project in the reference folder and set the Build Action to 'EmbeddedResource'.
And as Adam stated above, you need another AdditionalAppExtentsions block for the intent project.
adam-russell commentedon Mar 2, 2023
Great, looks like you got it working!
FYI, in case this is also helpful, my
.intentdefinitionis not in the main app in the packaged IPA that I can see. It's in both my widget .appex and my intents .appex, though, which are both in the PlugIns folder inside the IPA.PaoloUbisive commentedon Oct 20, 2023
Hi guys, it's my first time writing a Widget in iOS and I'm facing the same difficulties of @martic224 and @netzperfekt.
Since some of you managed to make it work, could you please share a sample project or something similar to a guide?
It would really help a lot.
tipa commentedon Oct 20, 2023
@PaoloUbisive try this example: AppWithWidget.zip
Unzip and run the run_app.sh script. It should build the app and deploy to your simulator. You will have to setup the Xcode project, signing, certificates etc. if you want to run it on a physical device or publish the app.
I haven't released an app with a widget extension to the store myself, so maybe there are problems that I haven't encountered yet
PaoloUbisive commentedon Oct 30, 2023
@tipa I finally managed to try your project and after some modifications it worked, thank you so much!
iancona commentedon Dec 29, 2023
what type of modifications you made? I'm wasting so many hours.. I signed everything correctly and changed bundleId/applicationId..
I think the issue could be the path but don't understand I should set it, I left it how it was in the @tipa project. It gives me MSB6006 "ditto" error like someone experienced.
ivmirx commentedon Apr 15, 2025
@tipa thanks a lot, it was a lifesaver after many hours of struggle with configs. In the past, Message stickers worked well from a .csproj, but something broke lately. So I configured them from Xcode and added as a native project.
Ended up moving the contents of
run_app.shinto iOS.csprojand now it runs from Rider too, both on simulator and device: