Oh, oh, oh.
Hello.
I didn't see you there.
Oh, so you've been looking to de build and deploy an iOS application
from Windows using .NET Maui.
Well, I got you covered whether you have a Mac or you don't.
There are multiple ways to deploy and build iOS applications directly
from Windows all over your network or directly to your iOS device.
And today I'm gonna break down every single thing that you need to know.
So tune in.
Hey everyone.
I'm James and I'm back today to talk about a problem.
That I've sort of skimmed over a little bit in some of my earlier videos, which
is how do you actually build and deploy an iOS application using .NET Maui, you
know, to a device or to a simulator?
If you're on a Windows machine and maybe you don't even have a Mac, how
do you do that development process?
Well, if you watch any of my getting started, or the tutorials you saw
that I talked about a few different pieces of technology that either enable
you to connect to a Mac or directly plug in your iOS device into Windows,
and I'm gonna break down those two different ways of de building and
deploying iOS applications today.
Now, the first one is a tried, trusted, true method of building iOS applications
from Windows, which is pairing directly to a Mac on your network,
such as my MacBook Air right here.
Now what this enables you to do is to do a remote build and remote deployment,
and the iOS simulator will show up either on your Mac or you have the
Remoted iOS simulator to show it up on your Windows device as well, which
is actually really, really cool.
So let's go ahead and take a look at how to get this set up, uh, automatically
from Windows and Visual Studio 2022.
Alright, the first thing that we need to do is have our project open.
Here I am.
I'm just inside of a brand new.net Maui application, and there's a few
ways to get the pairing working.
The first one I always go to is just this little pair to Mac button,
but you can also do iOS over here.
Pair to max a little bit off screen, but it's, it's definitely there.
Trust me.
Uh, when you tap on that, it's going to bring up this, uh, little dialogue.
Now, if it's your very first time, you're gonna see this how to pair
to your Mac instruction guide.
Now, what this will show you is that you need to go over to your Mac and
you need to enable remote login.
This is essentially going to enable your Windows machine to
connect to your Mac over s ssh.
You turn on remote login, you give it the specific usernames that you
want and you're off to the races.
Now, inside of this pair to Mac screen, uh, this is either hopefully gonna find
your Mac automatically like it has here, my ma MacBook air with my IP address.
Uh, and that's using the Bonjour service.
So you might see a bunch of odd things inside of there.
Hopefully just your max, but maybe some other Apli devices
or non appela devices sometimes.
Broadcasting there, uh, which is cool.
Or you can go ahead and say, add Mac and then you can go ahead
and add the IP address manually.
So I'm just gonna go ahead and double tap on this Mac.
It's gonna connect via s ssh.
I'm just gonna go ahead and enter my username and password.
Now.
This is the username and password of my Mac.
So when I went over to my Mac and I had remote login plugged
in, then it was all set.
Now this is the same process that works specifically back in the Zamarin day.
So when you're doing ZA and iOS or Zamarin Forms development,
this is the exact same thing.
Essentially what's gonna happen here is gonna go and it's gonna check
to make sure you have the right version of, um, of the done it, uh,
SDK installed the right versions of the iOS s sdk and everything that.
So here we can see that it's actually installing the.net SDK and it's
gonna do a bunch of other stuff.
So let's give it a few seconds here to get through doing this.
Um, because, uh, if you have the same build and the same version,
it's gonna be pretty quick, but if you have different versions, it's
gonna install a bunch of stuff.
So we'll give it a few seconds here.
All right, we're totally all connected.
We see that little chain link there.
That means we're totally good to go.
And we can see up here that it's pair to my Mac and it
has a little green icon here.
All right.
Now all we need to do is simply select our iOS device.
There's a few ways of doing this.
Lemme just make this a little bit smaller here.
So from our dropdown, we're gonna see that there are three options.
A local device.
Talk about that in a second.
Remote devices.
Remote device is, uh, if you have an iOS device set up.
Uh, on your Mac.
So it's actually plugged into your Mac.
It's a remote device.
Uh, you can also set it up inside of Xco to be a wireless device, so you
could actually just have this basically wireless to your Mac and then deployed
wirelessly here, which is kind of cool.
You can see my, my, uh, apple TV I think is set up there.
Then there's the iOS simulators.
So as long as you have the correct versions of Xcode installed,
then everything's up and running.
You're gonna have your iOS simulators there.
You do need, of course, Xcode installed on your Mac, just as you
would expect, you know, alongside your visual studio for Mac as well.
And this is gonna have all the different devices here.
So let's pick one like the iPhone se third gen.
I'm just gonna go ahead and snap this here, and I'm gonna hit run.
What this is gonna do now is compile up my application and then it's gonna go ahead
and deploy it to a remoted iOS simulator.
Now, there are two options, remoted, iOS simulator, or just a normal iOS simulator.
When you go to Tools, options.
You're gonna see here under Zamarin iOS settings.
Yeah, it's still under zamarin cuz it shares the settings with ZA and iOS.
Uh, here we can see that you can pair to Mac, which is the same screen,
enable auto connections to known Mac.
So if you want it every single time you open it up, you're good to go.
Down here you're gonna have the remote iOS simulator checkbox,
and then this is pretty important.
This is where you can update your version of Xcode.
I use an app called X Codes, uh, which I've done a video on.
I'll put it up over there to manage multiple versions of Xcode.
And here I'm running 14.1 for example.
So this is gonna go ahead and compile up my code.
Basically what it's doing is a remote compilation, uh, of all my
source code, and it's gonna compile it up into an executable to be
deployed onto the iOS simulator.
So let's give it a few seconds here and we'll be off to the races.
. All right.
We are deploying now.
And now we have this little iOS simulator here, which again is basically
gonna start up an iOS simulator on my Mac, which is kind of bananas.
And then it's going to go ahead and display it here on my Windows machine.
And this is kind of bananas cause if you do have a touch screen, it's
going to actually have all your touch screens, stuff like that.
There are different settings here for screenshots, rotation,
gesture, shake, and a bunch.
But there it is.
There's like literally an iOS device on my Windows machine.
I dunno, how cool is that?
Uh, that's pretty bananas in my opinion.
And you can scale to fit, you can do a bunch of other things like that.
And of course, you get full debug support as well.
So it's going to use your Zama hot reload, hot re, you know, reload,
all those other things as well.
And of course, this is just the default application, so it's just gonna
have the button clickers down here.
So, um, again, it's gonna go ahead and load up all the
assemblies for the first time.
It's happening on my Mac, so it does take a few seconds
here as it loads everything up.
Uh, and then we'll actually see it, uh, in real time, which is great.
reloading initially analyzing.
So cool.
And then boom, there it is.
And I can click, click, click.
I can of course, come into my solution.
Going to my main page.
Uh, I do get my Zama live preview up and running, which is very, very cool.
I can add break points over here and then I can go ahead
and tap on that break point.
I can inspect variables, everything that I would expect I could do, right?
I mean, that's what you would sort of expect for it to be doing.
And now we have our iOS application running here, and again inside
of the Zama live preview as well, which is super duper cool.
All right.
Now that is the first way in sort of the try true and tested way, like
I said earlier, of doing it because you're doing that full compilation.
So this is nice.
Uh, if for example, you have a lot of dependencies that are
using native libraries, you need access to a full compilation.
Maybe you're using, uh, health kit or something else like that,
that needs different entitlement.
You're gonna need to go through that full process of connecting up and going off to
your Mac and doing those things like that.
What if you're just getting started?
Or what if you're like me and a lot of my applications
aren't that crazy complicated.
I'm not using tons and tons of native underlying hood, you know,
libraries that need to be compiled.
What if you just want to not have your Mac and you want to,
I don't know, put it on your.
You know, you just have an iPhone, an iPad, iPod, touch.
If you still have one sitting around, probably a newer iPhone
or a newer iPad would be ideal.
What if you just want to take this and then deploy it over into
your, from your Windows machine?
We can do that.
Let's take a look.
, before we go any further, I have to tell you about our
partner this week, Skillshare.
Now, you may know Skillshare for their classes on photography, film, illustration
and more, but did you know that they have hundreds of career focused classes too?
And that was really the perfect time to reinvent your goals and
yourself and explore your passions.
Now, lemme tell you a few ways.
I've been personally utilizing skills share ever since I.
First is actually a classroom M K B H D, on content creation and YouTube
success that I've been applying to this channel and other content that I.
Now personally, if you're like me, you may have a lot going on, but that
doesn't mean that you can't take more time for things that fulfill you.
And personally, I've loved the classes around productivity and time management.
Ali Abdal has a delightful masterclass on productivity that
showed me the best habits and tools to help boost productivity.
And he also has a class that blew my mind on how to actually use notion,
which is something I've always want to, to use to help organize my.
There is something for everyone on Skillshare with endless opportunities to
learn how to design a career that fits you, and I'm really excited to partner
with them to give away a free one month trial to the first 1000 people that
use the link in my description below.
That's right.
The first 1000 people will get one month free trial to Skillshare.
All you have to do is use the link below in the description
and thanks to Skillshare for partnering with me for this video.
All right, so this piece of technology is called iOS Hot Restart.
Again, this is under Tools, options under the iOS settings,
and down here is the hot restart.
It's not my favorite name, but basically what it does is it uses the interpreter to
be able to run your app inside of the app.
Shell basically, Um, uh, that can be deployed onto your, uh,
device, which is nice, from your Windows machine with no Mac at all.
Now, there is some guides and documentation here.
The one caveat here is that you need to have a, you know, a 64
bit local iOS device vs 20 20 22.
You do not need to pair to a Mac build bil to, in fact, I'll
disconnect just to prove it.
Um, and the other thing here is you're gonna need to install iTunes, uh,
the, uh, from the Microsoft store or the 64 bit version on your machine.
And you need to have an Apple developer account and be enrolled
in the paid Apple Developer program.
Whew.
That is a lot of requirements, but if you have all these things,
you're totally good to go.
Now, the reason for.
Is because iOS to deploy to devices requires Apple developer accounts, certs
and certificates and all these things.
So that's how you're gonna need to actually be able to get it onto your
device here, which is really, really cool.
All right, so once we're good, I'm gonna go ahead and, and go
ahead and disconnect from my Mac.
So there we go.
And now we can see that I have no simulators, nothing on here at all.
Uh, and, and again, no local devices.
So what I'm gonna do is take my iOS device and I've plugged it in and
I'm gonna plug it into my machine.
. There we go.
Now you might need to go ahead and make sure if you get a popup that says, Hey,
you know, do you trust this device?
Make sure you trust it again, make sure you have all those dependencies
installed and everything like that.
And once you have that, you should see under the iOS local devices, your device.
And here is my iPhone 11 Pro, so I'm gonna tap.
, and again, that's under the local devices cuz it's local to this machine.
All right, now that I have my iOS device selected, all I need to do is hit debug.
Now, if this is my very first time building and deploying this project,
I'm gonna get this little popup here, which is setting up hot restart.
Now if I don't have iTunes installed and I don't have my Apple developer
account installed, that I'm gonna walk through that process here, but
I already have it, which is nice.
So all I need to do is come in and select my.
Now I'm gonna show you how you set this all up and the documentation is
great and what you'll do is create an A P I key in the Apple Developer
portal and plug it individual studio.
I'm gonna select my team.
This is gonna go through, make sure all the provisioning profiles,
everything is synchronized and good to go, and I can hit finish.
All right, and just like that, we can see now it's deploying
the application to my device.
Now it's gonna pop up this little message here that says, for the
first time I need to actually click on it, which I'm gonna click here.
We can see the.net Maui application opening and launching
from my device directly from.
Visual Studio directly wired through u SB to my desktop here.
And of course, I can be any Windows machine, such as my
service laptop over here, which I use all the time on the road.
And now we have our Hello world over here and boom, just like that.
We actually have it showing up inside a visual studio on
that ZMA live preview as well.
So I can click that, I can get my Zaha reload, I can get my Cs sharp,
hot reload, all that goodness that I would expect, which is pretty amazing.
All right, we did it.
Now there is quite a lot in there now.
I've gone through the hoops.
Sometimes you have to revoke different provisioning profile certificates.
You've been doing this for a while, might get some error messages and you're set up.
But if you're coming in fresh and you're setting up these accounts for the
first time, you're gonna be good to go.
Uh, as these things.
Sort of progress, the setup's gotten easier and there's
all sorts of good stuff.
In fact, I wanna show you really quick the guide over here.
So the guide walks you through this process.
So notice here there's more steps like iTunes, hot restart, all this
other stuff, and this will actually walk you through signing in with an
enterprise or individual account.
So here you set up your off key, your P eight key, all this stuff, and it
shows you how to create it inside of the app store Connect as well.
So all sorts of good stuff there.
So really, really easy to do.
It looks a little bit you.
Complicated.
But you know, in general it's, it's, it's a nice walkthrough
for everything that you need.
Like I said, if you've been doing this for a while and you have some
old certs sitting around, make sure you clear it out, make sure you read
any error messages that may come up.
But for me, it's been a really relatively smooth process using
these new a p i keys, getting anything, everything up and running.
Now a few caveats of hot restart.
You may notice that by default if you change your app icon, the
app icon is still the.net icon.
You're like, oh, that's weird.
Same with the splash screen.
Well, that's because, um, it's running your source code
inside of an app shell, right?
So it's not your actual app deployed.
It's an app inside of an app.
So it's really only for development purposes when you wanna go off
and actually build and compile and deploy your application to the app.
Then you're gonna need a Mac or a Cloud host solution or something like that.
Now, if you don't have a Mac sitting around, there are some options, obviously.
Obviously like GitHub actions, Azure DevOps, uh, app Center or Bit Rise,
all these different cloud CI services.
But there is actually Mac and Cloud, which lets you rent out a Mac.
In the cloud.
Basically.
It's been around forever and it has like Visual Studio for Mac
and all that stuff set up as well.
So there's lots of options there, which is really, really neat.
But I kind of wanted to walk through these different things.
Whether you pair to your Mac, get everything up and running, get iOS hot,
restart, running, all those things.
Let me know what you think.
If you've got everything up and running and deploying onto your devices
or onto remote at iOS simulator.
Let me know what your setup's like in the comments below, and other things
that you might wanna see from videos here on these different setups and guides.
So you can be super successful building.net Maui applications.
If you made it this far on the video, you are the best and I'd love it if
you could hit that like button down there and jam subscribe as well,
so you stay up to date with all the videos that I'm putting here on my
channel that's gonna do for this video.
Until next time, thanks.
So, Have it going.