I'm trying to debug a simple new Xamarin.Forms application on the IPhoneSimulator. I'm using Windows, and I'm paired to a macbook in my network.
The Xamarin.Forms template runs fine, but when I'm calling the Xamarin.Essentials.SecureStorage
API
var timer = new Timer(5000);
timer.Elapsed += async (sender, e) => {
timer.Stop();
await SecureStorage.SetAsync("message", "Hello world");
};
I'm getting the following error:
System.Exception: Error adding record: MissingEntitlement
So I edit my Entitlements.plist and enabled the KeyChain
entitlement. Tried to debug again, still the same error. So I go to project properties > iOS Bundle Signing and set the Custom entitlements
to my Entitlements.plist. This somehow switches the scheme to Manual Provisioning.
Could not find any available provisioning profiles for MyApplication.iOS on iOS
So I did what this answer said: https://stackoverflow.com/a/51615262/8941307. Now I'm still getting the MissingEntitlement exception.
When I remove the Custom Entitlements and switch back to Automatic Provisioning, I'm able to run the app again, but off course without the SecureStorage.
Do I need to have a $ 99 subscription to test these features like SecureStorage on the IPhoneSimulator? Would this work when using a physical iPhone?
EDIT
I'm able to debug the sample project from XCode from my macbook on my iPad (physical), but apparently I can't get it working with Visual Studio for Mac on my iPad. I'm getting the following error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Error: Could not find any available provisioning profiles for Helloworld.iOS on iOS.
What am I still missing in VSMac? Also I already trusted my developer account on my iPad, hence why I'm able to run the sample from XCode.
I've used XCode 12.1, located at /Applications/Xcode.app
You could create a free Apple Account for testing .
1. Sign into Xcode with personal apple account
You now have access to your Developer Account in Xcode . The developer account you added is called “Personal Team”, which should show up in the list on the right.
2. Run Apps on real device
Make sure your iPhone (or iPad) is connected to your Mac via USB. When your iPhone prompts you to confirm connecting to your Mac, tap Trust.
Then, in Xcode, choose the Window → Devices and Simulators menu. Select your iPhone from the list, and then click the Enable Device for Development button. (Depending on the context, this may not be a necessary step.) It’s also smart to enable the Connect via network option, which lets you debug apps on your iPhone without connecting via USB.
Now you can test your code with Auto Provisioning both on simulator and real device .