Release Your .NET MAUI iOS App to the Apple App Store

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you've put the final touches on your dotted maui ios app but now you're wondering how should i actually deliver this to the store well don't worry this video is going to take you from generating all the certificates and all that kind of hard stuff to um having an ipa file that you can deliver to the app store so tune in in case you're wondering i also have a video on the android version of this so that should pop up on your screen right now or check down below in the comments i have a link to there as well and there you know it's kind of like a similar process you have to build your application you have to sign the binary to prove that you're the one that created this app and then you can deliver it to the google play store or in this case the apple app store right so why do we actually need to have that extra signing step right well if you've been wandering around the internet then chances are that you are doing that you know that everything is about security right so we have these certificates also if you go to a secure website we have these certificates to kind of prove that the connection is secure that the website is who they say they are and that's kind of the same for like these apps you have to generate the certificate so that it gets signed the binary gets signed so that it's proven that you have created this ad binary and that they maybe some people who are not as nice as you are have tinkered with the app and maybe put in some malicious code to do all kinds of crazy stuff with your end users and you are coming up with some kind of scandal in the newspapers that's not something that we want to do right so we want to sign our binaries and with that prove that you are the one that created this binary now other than with android um you're not kind of stuck to this one key store and if you lose it then you cannot upgrade your versions anymore um here the versions are very much determined by like the bundle identifier so the com.yourcompany.app that kind of unique identifier and you can just regenerate these certificates and all the things that you need for your app from the apple developer portal so don't worry about actually saving that you can still recover if that's needed but still you know you might want to make sure that everything is okay there and also for apple that's a good thing you to know the certificates expire once a year you also have to renew your apple developer account for each year so each year you have to do this again that is if you want to update your app right if the app is in the store and there's nothing to update and that's fine you can leave it there for years but typically you want to update your app regularly right so you want to go through this once a year so you can bookmark this video and set it into your calendar for once a year you can review this how is this stuff working again that's usually how i do it because i always have to look up how to do it um but let me just you know stop right here and well maybe you want to subscribe first maybe you're new here welcome subscribe to my channel so that this video pops up automatically once a year and like this video so more people can discover it as well thank you so much okay so with that out of the way now we can finally start so the first thing we want to do because i'm going to take you from square one here like i said i'm going to show you all the things that are necessary so this video might be a little bit longer but it will be worth it so make sure to stick around till the end so that you know all the steps involved here now this is developer.apple.com and you want to go to account here note that if you're watching this in the future it might look a little bit different but um you know all the ingredients should be still here so then we are here in our account and then we have the certificates identifiers and profiles that's where you want to go so let's click on that and whenever we get here we have a couple of steps that we need to go through so first we have to have this certificate that kind of proves that i'm the person that um i am and then from there we are going to create a app identifier that's one thing that you only need to do once per app basically and if we have that we can create a provisioning profile that inside well it's not inside but it's linked to our certificate um so our provisioning profile can only be used by the one that created their certificate so there's kind of like you know a couple of tiers here but we will see how that all fits together so for the certificates um i got a couple of certificates already in here but you can create new ones like i said so let's just click this little plus button here and then you have to choose from a list right so you can choose apple development apple distribution ios app development ios distribution etc etc there's a couple of things here but the options that you probably want to use is either apple development or ios app development or apple distribution or ios distribution so you can also use certificates for development from visual studio it's very easy to use those you can just use the automatic provisioning and they will be created for you automatically you don't have to do this basically but you could do it manually if that's what you want you need that to run your development apps actually on a physical device so you can use those and you need a different certificate for actually distributing it through the app store so that's what we're after and then the difference between the apple and the ios one is you can sign your apps for submission to um for oh let's let's just stick with this description so for ios mac os tv and os and watch os um and here there are separate ones for just ios and just uh mac app so that's just for mac os so because that and maui can do both mac os and ios you probably want to choose for the apple distribution one i'm going to go for the ios distribution one right here but that should basically all be the same so it doesn't really matter actually let's be adventurous we're just going to take the apple distribution one so we're going to get that and now we have to get first a certificate signing request from our local machine so that's why you need a mac also for the development so what you want to do is go to your keychain app you can just get it here keychain access go here and this should pop up on this screen right here we don't need to do anything with the actual ui right here we want to go to our menu options to the keychain access option then go to the certificate assistant and go to the option request a certificate from a certificate authority so then we get to this assistant to this wizard it should pre-fill with information from your user account so here's my email address so here's my name and i'm going to click save to disk so let me just do that and continue and then it should ask me like hey where do you want to save this thing too so let me just get here into downloads and my little demo folder so that we don't get distracted with all the other junk that's on my computer so i'm going to save it to this little folder and this is a cert signing file so let me pull it here from a other screen so here we have now this file and this file we can use to actually generate the certificate on the apple developer account so i'm just going to drag this into here you can see that this field is filled and now i can click continue you can see some more details here and i can just now download this file and it will download that to my computer and let me actually show you here that's also showing up here in my distribution.sir so dot certificate and if i double click this we will be back in the keychain right here and it will have imported this certificate in the keychain now let me look up this is called something with distribution right this tree distribution so i got again a couple here the apple distribution from well this is the time stem that i'm using right here so this is the one that i just imported while we are here let me note right now that this is a name so this kind of name apple distribution colon my name and the team id which is associated to your apple developer account this string is something that we need so you might want to copy this save it for later i'll be back with that for in a little while so you want to save that little string right here so now that we got this we can go back to the home of my developer portal right here and we want to also make sure that we have the app identifier so go to identifiers right now you can see i got a couple of other app identifiers already in here from test apps but you might want to add your new one so let's click new the plus sign and i'm going to create a app id so if you want to do other stuff that's fine but we're after the app id for right now so let's click continue i want to do an app not an app clip so again continue and here you can set a description so this is just a description i'm not sure if this is going to be shown in the app store but let's just call it my maui app ios signing sample i don't know something like that and then you can set the bundle id that's the thing i mentioned right so this is going to be your unique identifier for your app it has to be unique across the app store so you can choose one that's already there and this is the one that's going to be used for your application so let's do com dot maui ios signing sample dot general i don't know something like that it doesn't really matter what it is as long as it's unique and also um well i don't think you actually need this one this one needs to be the same inside of your info.plist file right so you have to add it there as well now of course if you want to have other capabilities then you need to click them here so if you want to use um i don't know notifications data protection all these kinds of other things fonts then you definitely need to check some things here but for now that's outside of the scope of this video so i'm just going to click continue again and again i think you need to do some things here i don't know this is maybe just a overview i need to confirm okay and just register the thing here so that's done it should be in my list here right now and from there when i ever have that this is just registering here in the portal i can go to profiles and in profiles i'm actually going to create a provisioning profile that's something that gets added to my app which links the the certificate and my app and all the things kind of like together so let's add a new one for that as well and here you get to choose like hey is this for development again so you need to be aware that you'll link the right things for development and distribution but we're after the distribution right we're going to go to the app store so let's click here for the app store and note that this is something separate for the ios app store which is just called app store here or the mac app store so you need to create two for like your ios app and for your mac os app for a mac os app i will have a video as well so be on the lookout it might pop up on your screen if it's ready yet or find it down in the comments below the link as well but for now we're after the ios app so let's click app store and click continue again and here we have to select that app id right so here you can see the things already coming together so here we're going to have the maui ios sample now this is actually one i created earlier so let's scroll a little bit down to the other that i just created where is it my maui app ios sign example there it is so let's just click that one and click continue and now we have to select certificate that we've created earlier but now i'm kind of confused because i'm not sure which one of these february 4th i should pick here so let's just do the latest and hope that is the right one and click continue again and i need to name my provisioning profile right here so my maui ios signing again this is a name that you need so please note this provisioning profile name as well click generate click download and it will be downloaded to the same folder again so let's open that and you can see this mobile provisioning file right now double click that and that will open xcode and it will be loaded into xcode automatically that is a important thing you need that for all of this to kind of make sure that it works because the following stuff we're going to do on windows where we actually go to sign this but it's going to go through your mac build host and your mac build host needs to have this stuff in the keychain it needs to have this mobile provisioning file so that is all stuff that you need but this is all we need to do well all we need to do it was quite a lot right um in the apple portal so now that we have all this in place it's time to switch over to visual studio 2022 and actually incorporate this into our dot maui app so we can create a ipa file that we can publish to the store so here we are in visual studio 2022 a preview version right now because at the time of recording we are still in don and maui preview um so we also need to use the visual studio 2022 preview version for that if you're watching this and dotnet maui is already ga um this process is exactly the same for don and maui ga as well so don't worry about that but you know at this time it's still preview now this is the exact same project that i've already also already been using in other videos where for publishing the mac os app and the android app um so depending in the order you're watching them there might be things missing or being added but i'm going to add this all in this one app because that is a typical scenario right you want to create this app once and publish it to all the stores so i'm going to continue with um i only have the android one in here but i'm going to add the ios stuff in here as well now what might be good to do is um like i said you're going to need a mac build host so that is you saw me just busy on a mac it's in my network i can just click here this little thing pair to mac i think it's also under tools ios right here and you can pair to mac from here as well and you can pair to your mac i would suggest that you do it through this wizard first because that will force you to log in it will check all the requirements on your mac side as well and whenever that is done whenever that is linked successfully then you have been logged in once and you don't need to enter your password in kind of like the command line that i'm about to show you as well of course if you're doing this through a build pipeline then you can add your password as a secure variable in there and then use that inside of the command line as well or you know if you're just a single developer working on this project you can also add the password inside of your cs proj make sure to never push that of course to a public repository um so i would not recommend that but there's a couple of options that you can do here but if you have are going to do this from visual studio on your device and you have been paired to this mac before then you don't need to specify the password but i'll mention that in a little bit as well one other thing that you might want to do is add a entitlements.plist so if we go here into the solution explorer into the platforms and into ios here we have the info.plist but if you're going to use stuff with like icloud or push notifications or whatnot you're also going to have to have a entitlements.plist maybe that's something that we're still considering we're adding a entitlements.plist in the default template so it might be there for you already if not you can simply create one by right clicking here doing add new item and i'm just going to say a simple xml file i think i don't know let's see general do we have some kind of xml file here well a text file will do as well and i'm going to name that entitlements.plist and i'm going to click add and um whenever we do maybe it already comes up i'm not sure if it comes up with the editor i don't think so um oh it says fail to generate because there's nothing inside of it right so let's right click and do open with and then i'm going to choose the xml text editor and inside of that you can just add some dummy code the link to this sample app is on github so find that in the description down below you can just paste that in here or we're going to add this dummy thing for you and whenever the kind of like empty dummy content is here then you can double click it and you will get this wizard right so that will help you um do all the things so if it's not in there this is how to do it if it's in there you can just double click it and do it it's only needed when you want to do something with with any of the stuff that's in here so if you don't do anything fancy don't worry about this but i just want to be complete in this video so whenever you have that we're now going to add a new property group into rcs proj so what i'm doing here is um you know just clicking here on this cs proj file and that is the source it's just another xml file and you can already see that i've added this property group for android um only for the configuration of release where i specify all the keystore and a password and that is used for signing the android app now i'm going to do the same thing for ios so let me add a new property group here i'm going to copy this from somewhere off screen so don't uh don't be scared here we are it's coming in right now and here you can see it kind of follows the same pattern so this property group is only included whenever our target framework is ios right we only want to do this for ios and only whenever our configuration is released because that's just you know whenever we are going to release our app that's the thing here right so if you select debug or release the configuration that you set here then you want to set this runtime identifier to ios arm 64. that's just a given you should do that for the time being unless ios or apple decides at some point that they want to switch architectures then we have this little node for the entitlements p list so you have to enable this if you want to use that entitlement speed list but if you don't want to use it then you can leave it in comments and maybe revisit that later now here this here's where it gets interesting here we have this code signed key and this is the name that i said like in that early certificate thing right so that's the certificate that we downloaded the dot server file that is the name that you had to remember had to copy and now you have to put it here in this code sign key and the same thing for this code sign provision this is the name of our provisioning profile the mobile provisioning profile now it will only be able to find this by these names if this is in your keychain if this is in your xcode on the mac build host so that's why it's so important to load it there so if something's not working if it says like hey i can't find something open your keychain open your xcode and check if everything is okay in there now with this in place we basically have everything to actually go and create our app so if you have been connected to your mac your mac build host through pair to mac then you can actually just do a build on release and there should be a resulting ipa file in your output that you can use and send to the app store but of course you know i'm said i'm going to show you how to do this in the command line so let me just open the integrated terminal right here i just did control back tick you can also go to view and terminal right here to open it and this will open a little powershell terminal and again i'm going to copy a little thing here so you don't have to watch me type the whole thing and there's a couple of interesting things in here so let me show you we're going to do dot net publish then we're going to specify dash f so the target framework which is dot net 6.0 ios which is you know we can look at the targets here target frameworks and we have these these multiple things right because it's a multi-targeting project that we have here for dot and maui so this should be the same as net 6.0 ios that's just a given that is what it's supposed to be now let me scroll down here a little bit so we can show all the things then you can say the configuration should be release right so we want to build the release configuration to trigger this condition right here so ios and release then you have to specify the server address for your mac build host now for this it should be easy you can just go into your power mac and you can find the ip address here but if you're in a hosted build pipeline thing then you might want to know the ip address also on that mac build host you're going to have the the username right so we have this server user for me it's just my handle so that's the user that's set up to be able to log in and actually do the ios build host tcp port should be the default one five eight one eight one then we want to say archive on build to true which is just a property something that we need to do then we have this.net root remote directory which is a directory where xamarin is installed if you're able to debug and run your donnett maui applications through your mac build host then this directory should be right here the only thing that you want to replace here is in your users with your username so that kind of should be the same as the server user right here you can just reuse that in the path right here now at the time of recording there's a little bug in like the dotnet for ios stuff and you want to use this switch the enable assembly il stripping you need to set that to false else it will fail but if you're watching this sometime in the future then hopefully you should not need this anymore because the il stripping is actually something useful that will take out stuff that's not needed for your app to make your app smaller so you want to have that enabled by default and then you have this server password that is the password that you want to use for this user account to actually connect to your mac and actually do the building now this password is a dummy one so don't try to hack me i can remove this one because i connected to my back build host earlier and then the password is cached so um i don't need to enter it here anymore but i can if that's what i want now if i run this it's going to build right here it's going to connect to my mac through all these things you can see things rolling by and at the end of this i'm probably going to do a little edit here in the video because this might take a while we should see an ipa file that is actually publishable to the app store oh and here you can see actually well this is this is a good thing i'm just going to leave this in you can see here the error like project bundle identifier com.companyname.maui publishing sample app does not match the specified provisioning profile for my maui ios signing see and there is where you see we have to match all these things so let me go into my solution explorer and we have this info.plist because here my bundle identifier has bee has to be the same as what i entered in the apple developer portal and in my case let me just paste it in here in my case that was com.maui ios signing sample.gerald right so let me save this info.plist and then i'm going to try again i think this terminal window is stuck for some reason so i need to copy this command again and let me just open a new terminal right here and see if we can get it to work so now the build starts again and you can see this already does some other things right so it seems to pick up on my provisioning profile now and again i might do a little cut here in the video where we should actually have this ipa file that we can now publish oh actually here you can see it picked up on my code signing key my provisioning profile seeing this message shows you that it actually detects this signing identity right so it got all the ingredients to actually build the application for me right now now we fast forwarded a little bit in time and actually something interesting came up because we have this dialogue which looks very much as a mac os dialogue and that's because it is um so i'm running like this remote desktop thing so that's why you're seeing mac things here as well and this dialog comes up on your mac device whenever you want to sign something from your keychain so you'll have to enter your password so that it can access your keychain and it can actually sign the binary that you're trying to sign so let's just enter your password here and then whenever we do you can click always allow maybe that means that it won't come up the next time it will actually finish signing our binary right here and you can see some more consoles stuff scrolling by there's lots of stuff here already and when it's done then we actually have a ipa file that we can use to roll out to the app store now while this is finishing up let me tell you this other thing um so let's go back to the cs proj file here for a little bit and if we look at like the android stuff that's in here i'm specifying all these things just like for ios by the way with all these properties all these xml tags right here now all the options that i put in the command line as options so if we scroll all the way up then you can also specify all these p parameters i can also specify that as properties inside of my cs branch so if you don't want to type all these command line parameters here all the time then you can also set like server address i can just copy this and i can add here server address um not with the colon and slice server address and i can just add the value in here and whoops well actually let me just type that in here so that was something like 192. um 168 0 77 something like that you can just type the values and then the things in there and then i can leave it out of the command line arguments there and you can also mix and match so some values can be here in the cs product some values can be command line arguments you can do that whatever you want whatever suits your requirements however you want to use this in your pipeline or whenever you're building locally whatever makes sense to you so that is how you can do this now let's check out i'm not getting the command line back here for some reason so don't worry about that but you can see here created the package bin release publish maui publishing sample app so let's go to our solution explorer i'm going to right click the project right here open in file explorer we will get the folder right here and we can go to bin release ios ios arm 64 and then we have the publish right here and this ipa file is the one that is signed ready to go you can upload that through the transporter app to your apple developer account and you can release that to the actual app stores so this was a bit of a longer video because you know all the hassle with the certificates and the signing especially for apple that's like a big hassle a big pain to go through each time each year but now you know how to do it from like step one rewind the video take as long as you need watch it a couple of times until you know how to do it and you don't know how to do it just from visual studio now but also how to integrate that in your pipeline through the commands that i've given you now if you want to watch here you can see the same video for windows so you also know how to release your windows app or if you still have to build your dot and value app please click on this playlist and there's a lot of content on dot maui as well and i'll be seeing you for my next video you
Info
Channel: Gerald Versluis
Views: 24,066
Rating: undefined out of 5
Keywords: .net maui, dotnet maui, .net 6 maui, .net maui getting started, dotnet maui tutorial, .net maui tutorial, .net maui ios, Apple App Store, Release .NET MAUI App iOS, apple developer account, ios provisioning profiles, dotnet maui ios release app, .NET MAUI ipa file, dotnet maui ios, apple developer account tutorial, .net maui preview, entitlements.plist, signed ipa ios, Visual Studio 2022, VS2022, ios provisioning profiles explained, .net 6, dotnet 6
Id: kpZi5xAvpZA
Channel Id: undefined
Length: 27min 22sec (1642 seconds)
Published: Mon Feb 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.