Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,270 --> 00:00:00,460
All right.
2
00:00:00,520 --> 00:00:07,290
So for those of you guys who have a physical iPhone device or an iPad device even, and you would like
3
00:00:07,290 --> 00:00:14,240
to run the Flutter apps that you create onto your physical iOS device, then you are in the right place.
4
00:00:14,250 --> 00:00:16,940
That's exactly what we're going to cover in this lesson.
5
00:00:16,980 --> 00:00:22,320
Now, before we can get started there's a couple of prerequisites that you have to fulfill before you
6
00:00:22,320 --> 00:00:23,520
can actually do this.
7
00:00:23,550 --> 00:00:29,970
One is you must have an Apple I.D. So you must have registered with Apple at some point, giving them your
8
00:00:29,970 --> 00:00:32,320
email and have a password.
9
00:00:32,310 --> 00:00:36,300
Now this Apple I.D. doesn't have to be a developer account.
10
00:00:36,300 --> 00:00:41,880
So it could be any sort of Apple account that you have. Anyone that you use to say download apps from
11
00:00:41,880 --> 00:00:47,060
the App Store, or the ones that you use to log in on your iPhone.
12
00:00:47,070 --> 00:00:51,440
Now the next thing you need is a iPhone or an iPad device.
13
00:00:51,450 --> 00:00:56,940
Our apps are not going to run onto a watch or any other type of Apple device. It has to be something
14
00:00:56,940 --> 00:00:58,140
that can run iOS.
15
00:00:58,140 --> 00:01:04,410
So one of these two. And then three, you're going to need Xcode already installed, which we already did
16
00:01:04,470 --> 00:01:11,100
previously in the setup instructions. If you haven't done that, then you'll need to do that now before
17
00:01:11,100 --> 00:01:12,750
we can continue.
18
00:01:12,780 --> 00:01:16,540
And finally, you're going to need a good quality USB cable.
19
00:01:16,650 --> 00:01:22,530
And strangely enough, we've discovered through years of teaching students that USB cables are not created
20
00:01:22,560 --> 00:01:23,300
equal.
21
00:01:23,460 --> 00:01:28,710
And some of them will only transfer data whereas other ones will only transfer power,
22
00:01:28,830 --> 00:01:31,560
and you need both power and data.
23
00:01:31,560 --> 00:01:37,380
So best case scenario, you have the original cable that you got from Apple, which is hopefully not yet
24
00:01:37,470 --> 00:01:43,990
frayed because they tend to do that. Or you have a good quality USB cable from another provider.
25
00:01:44,070 --> 00:01:47,910
Once you've got all of these four things, then we're ready to move on.
26
00:01:48,240 --> 00:01:49,560
And just a word of warning,
27
00:01:49,560 --> 00:01:54,450
there's quite a few steps that we have to go through, and they're kind of like the hoops that you have
28
00:01:54,450 --> 00:01:59,980
to jump through before Apple will actually allow us to install our app onto our phone.
29
00:02:00,030 --> 00:02:03,310
And as you can imagine, Apple is very serious about security.
30
00:02:03,420 --> 00:02:08,940
So there's about 10 steps that we have to go through. But I will go through each of them with you, together
31
00:02:08,970 --> 00:02:09,720
step by step.
32
00:02:10,140 --> 00:02:17,730
So the first step is you have to make sure that the iOS version on your physical device is compatible
33
00:02:17,730 --> 00:02:19,900
with the Xcode version.
34
00:02:19,920 --> 00:02:25,880
Now generally speaking, the Xcode version is two versions behind iOS.
35
00:02:25,890 --> 00:02:27,390
What does that mean?
36
00:02:27,390 --> 00:02:32,970
So here I have my Xcode application open, and you can see that the version that's registered on it
37
00:02:32,970 --> 00:02:36,160
is currently 10.2.1.
38
00:02:36,180 --> 00:02:41,520
Now on the right hand side here, I've got quick time that's rendering my current iPhone.
39
00:02:41,520 --> 00:02:49,230
And if I go into settings, and I go into general and about, then you can see that the current software
40
00:02:49,230 --> 00:02:55,770
version I'm running is 12.2. The number that we're interested in is that, if you have an iOS version
41
00:02:56,190 --> 00:02:59,820
of say 12, then minus 2 becomes 10.
42
00:02:59,850 --> 00:03:04,990
So Xcode has to be at least version 10 in the first number.
43
00:03:05,010 --> 00:03:07,950
Now the second number has to be lower on the iPhone.
44
00:03:07,980 --> 00:03:11,960
So if this is a 2, this has to be a minimum of 2.
45
00:03:11,970 --> 00:03:18,150
So if I had Xcode 10.3, 10.4 etc. that will also work with this version of
46
00:03:18,150 --> 00:03:18,630
iOS.
47
00:03:18,630 --> 00:03:25,460
But basically, your Xcode has to be ahead of, or equal to your iOS software version.
48
00:03:25,770 --> 00:03:29,130
And there's a gap of 2 on that major number.
49
00:03:29,160 --> 00:03:33,540
So 10 matches with 12. 11 would match with 13.
50
00:03:33,540 --> 00:03:36,950
Eventually when Apple releases iOS 13.
51
00:03:37,320 --> 00:03:45,270
But if your Xcode is too old, or it doesn't match with the iOS version, then the easiest way is to
52
00:03:45,360 --> 00:03:47,640
update Xcode to the latest version.
53
00:03:47,640 --> 00:03:50,780
So open up the app store and update it there.
54
00:03:50,910 --> 00:03:56,640
It is very hard to go back in time for your iOS version.
55
00:03:56,640 --> 00:04:01,060
It's much much easier to upgrade Xcode to the latest version.
56
00:04:01,080 --> 00:04:07,680
Now however, some of the latest versions of Xcode will require you having the latest version of Mac OS.
57
00:04:07,740 --> 00:04:12,720
So if you go into this little Apple sign and you click on About this Mac, you have to make sure that
58
00:04:12,720 --> 00:04:17,810
you're running Mac OS Mojave to be able to run the latest version of Xcode.
59
00:04:17,880 --> 00:04:23,970
So if you have one of these things that are a bit older, then you might end up initiating a chain of
60
00:04:23,970 --> 00:04:31,260
updates where you first update your Mac OS and then you update your Xcode. So you go onto the app store
61
00:04:31,290 --> 00:04:36,990
and you can see that there is a later version of Xcode but it's not letting you update,
62
00:04:36,990 --> 00:04:44,640
then the reason might be because you have a older version of Mac OS. Because there are minimum requirements
63
00:04:44,760 --> 00:04:46,730
on all of these pieces of software.
64
00:04:46,860 --> 00:04:53,100
So you can see here, we need at least Mac OS 14.3 or later. Which is exactly what I have,
65
00:04:53,100 --> 00:04:55,600
I actually have a later version of Mac OS.
66
00:04:55,800 --> 00:05:00,770
But once you're done with that and you've made sure that your Xcode is compact with your iOS version,
67
00:05:01,100 --> 00:05:06,140
then we can move on to the next step, which is to install homebrew.
68
00:05:06,200 --> 00:05:10,910
Now we're going to do this by following the tutorial on the Flutter docs page.
69
00:05:10,910 --> 00:05:18,860
So under install, when we go to the Mac option and we go to deploy to iOS devices, you can see that
70
00:05:18,860 --> 00:05:21,610
there are detailed step by step instructions.
71
00:05:21,620 --> 00:05:26,960
Now there's a couple of bits missing here that I think are really important which is why I'm walking
72
00:05:26,960 --> 00:05:32,220
you through it in video format, but there's a couple of other things that we definitely have to do.
73
00:05:32,360 --> 00:05:34,960
And the first thing is to install homebrew.
74
00:05:35,050 --> 00:05:41,300
So if you click on this link right here, it'll take you to brew.sh and on this page it will show
75
00:05:41,300 --> 00:05:43,520
you how to install homebrew.
76
00:05:43,940 --> 00:05:51,590
So all we have to do is to copy this line in its entirety, so we hit COMMAND + C to copy.
77
00:05:51,590 --> 00:05:53,930
And then we're going to launch terminal.
78
00:05:53,930 --> 00:05:59,540
So if you go into this upper right corner and click on the magnifying glass, you'll launch Spotlight
79
00:05:59,780 --> 00:06:04,260
and then we're going to search for something called a terminal, and we can hit ENTER
80
00:06:04,280 --> 00:06:10,770
once it finds it to launch our terminal application. Now once terminal has launched, then you're going
81
00:06:10,770 --> 00:06:18,420
to paste that command you copied over, and you get to hit ENTER to install homebrew. And you can leave
82
00:06:18,420 --> 00:06:24,590
it running for as long as it takes. And then go ahead and hit ENTER to continue.
83
00:06:25,140 --> 00:06:27,490
And it's going to ask you for your password.
84
00:06:27,510 --> 00:06:34,170
Now the password it wants, is the one that you use to log into your Mac. And your user account on
85
00:06:34,260 --> 00:06:40,050
your Mac that you're currently logged into, has to be one with Admin privileges. Because it's going to
86
00:06:40,050 --> 00:06:44,760
be installing homebrew onto the computer for all users to use.
87
00:06:44,760 --> 00:06:50,040
So I'm going to type in my password and notice that it doesn't actually show what I'm typing, so you're
88
00:06:50,040 --> 00:06:51,250
typing blind.
89
00:06:51,420 --> 00:06:54,570
And, if you get it wrong, it'll just tell you so you can try again.
90
00:06:54,690 --> 00:07:00,600
But once you're done, hit ENTER, and it will continue installing homebrew.
91
00:07:00,600 --> 00:07:06,810
Now you'll know it's done because they'll tell you installation successful, and you will also be able
92
00:07:06,810 --> 00:07:11,910
to see your prompt which is your user name and also the $.
93
00:07:11,910 --> 00:07:18,330
So now that we're done with installing homebrew, we're going to be using homebrew to do a couple of things
94
00:07:18,330 --> 00:07:26,520
that Flutter will require to be able to run your app onto iOS. Here under Step 3, in deploy to iOS devices,
95
00:07:26,850 --> 00:07:32,730
you're going to copy each of these instructions one by one and you're going to paste it into the terminal.
96
00:07:33,240 --> 00:07:39,230
Right here, and then we're going to hit ENTER. Now, as it says here,
97
00:07:39,240 --> 00:07:47,130
the first two steps here is because, Flutter is currently using a opensource package which is developed
98
00:07:47,130 --> 00:07:53,670
by an external developer, and these two steps may go away at some point in the future.
99
00:07:53,700 --> 00:07:59,460
So maybe when you're looking at this page sometime down in the future, you might not see these two instructions,
100
00:07:59,520 --> 00:08:01,740
in which case, you don't need to do it anymore.
101
00:08:01,770 --> 00:08:03,420
So this is just a quick heads up.
102
00:08:03,540 --> 00:08:10,420
But as of right now it is still an essential step if you want everything to work.
103
00:08:10,800 --> 00:08:16,170
So once you've done that step, then you're going to go and do the next step and you're basically going
104
00:08:16,170 --> 00:08:24,120
to go through this one by one, until you get to the very bottom. And they will take different amounts
105
00:08:24,120 --> 00:08:31,110
of time to complete, but you will always know once it's done by seeing your prompt and then you know
106
00:08:31,110 --> 00:08:37,530
that it's time to add the next line of code from the Flutter website.
107
00:08:37,560 --> 00:08:44,880
And when you get to this line where it says 'brew install', all of these things, 'idevice installer ios-
108
00:08:44,880 --> 00:08:46,170
deploy cocoapods.
109
00:08:46,230 --> 00:08:48,750
This is the one that's going to take the longest basically.
110
00:08:48,780 --> 00:08:53,090
So, this is one where you have to be really patient.
111
00:08:53,130 --> 00:08:59,370
So once that's all done, we're going to copy the very last line which is to set up something called cocoa
112
00:08:59,370 --> 00:09:03,630
pods, and this will take a little while as well.
113
00:09:03,630 --> 00:09:11,430
Now once that's complete, you should see 'Setup completed' and we're now done with Step 3, and all of this.
114
00:09:13,320 --> 00:09:22,550
So we're now ready to move on, where we open up Xcode, and we add our Apple I.D. So in order to do this,
115
00:09:22,610 --> 00:09:28,220
you're going to go into Android Studio, and you should have the 'I Am Rich' project already open.
116
00:09:28,220 --> 00:09:32,330
If not, go ahead and open it from file, open or open recent.
117
00:09:32,330 --> 00:09:34,190
You might see it in there as well.
118
00:09:34,190 --> 00:09:39,620
And once you're here, you're going to locate the iOS folder in your project navigator.
119
00:09:39,620 --> 00:09:45,080
So if you're in a different view, say the Android view etc. then make sure you're inside the project
120
00:09:45,090 --> 00:09:53,750
view. And you're going to right click on the iOS folder, and go to Flutter, then open iOS module in
121
00:09:53,750 --> 00:09:54,460
Xcode.
122
00:09:54,620 --> 00:10:00,770
And this should automatically open up Xcode, and open up the runner project which contains all of
123
00:10:00,770 --> 00:10:05,650
the iOS part of our 'I Am Rich' app. Now,
124
00:10:05,680 --> 00:10:12,310
if that doesn't work for you, then you can also go ahead and right click on this iOS folder, and click
125
00:10:12,340 --> 00:10:18,490
on 'Reveal in finder' and once you're here, you should be able to expand that folder,
126
00:10:18,490 --> 00:10:26,080
and here, you can simply double click on the runner.xcworkspace to be able to launch it inside
127
00:10:26,080 --> 00:10:28,110
Xcode.
128
00:10:28,220 --> 00:10:36,080
Now, once you hear, you're going to click on the runner project. So it's the one that has the blue icon.
129
00:10:36,400 --> 00:10:40,100
And now you're going to be adding an account.
130
00:10:40,150 --> 00:10:47,410
So here where it says team, if you have never developed an iOS app before, you will have to add your Apple
131
00:10:47,410 --> 00:10:48,520
I.D. here.
132
00:10:48,520 --> 00:10:54,010
So here you're going to put in your e-mail that you use to logon to Apple, and then it's going to prompt
133
00:10:54,010 --> 00:10:56,960
you for your password.
134
00:10:57,030 --> 00:11:03,090
Now once you've successfully logged in with your Apple I.D. then you should now be able to go into the
135
00:11:03,090 --> 00:11:07,620
team selector and select the account that you've just added.
136
00:11:07,620 --> 00:11:12,970
Now because mine is a developer account, it will show up with our company name.
137
00:11:13,080 --> 00:11:19,430
But in your case it should probably be your name, or the email that you use to log in.
138
00:11:19,430 --> 00:11:27,050
So now we're finally ready to connect your phone with USB. So hook up your phone to your Mac.
139
00:11:27,050 --> 00:11:32,720
And at this moment in time, you'll probably get a popup that ask you whether if you trust this computer
140
00:11:32,720 --> 00:11:37,830
that you connected your phone to. The popup should look something like this.
141
00:11:37,830 --> 00:11:43,530
And even though we're always used to clicking on the right hand side and and always the bolded words,
142
00:11:43,590 --> 00:11:47,190
be sure that you click on 'Trust' over here instead.
143
00:11:47,520 --> 00:11:51,110
Be careful that you actually click on the right one.
144
00:11:51,200 --> 00:11:56,510
Now if you accidentally clicked on the one on the right, then be sure to unplug your phone and re-plug
145
00:11:56,510 --> 00:12:01,820
it to hopefully read trigger these popup, and trust it.
146
00:12:01,850 --> 00:12:06,530
Now there's one more thing that we have to trust, which is our development certificates. So it's the
147
00:12:06,530 --> 00:12:14,990
Apple I.D. that we added just now in Xcode. And the easiest way to get this to trigger, is to actually
148
00:12:14,990 --> 00:12:19,990
click Run inside Xcode to try and run it on to your physical devices.
149
00:12:20,060 --> 00:12:24,200
If your device that's currently connected is not showing up right here,
150
00:12:24,260 --> 00:12:29,930
make sure that the team is selected, and make sure that you've had a look inside this drop down and you've
151
00:12:29,930 --> 00:12:31,990
been able to select the device.
152
00:12:32,000 --> 00:12:36,610
Now you can click Run, and after you run it from Xcode,
153
00:12:36,740 --> 00:12:43,340
If your app doesn't automatically launch on your iPhone, then it's time to go into your settings, go under
154
00:12:43,340 --> 00:12:52,040
general, and then try and find device management, to find your Apple I.D. and then click on 'trust' to trust
155
00:12:52,040 --> 00:12:59,390
your developer I.D. And once that's done, you should be able to come back to Xcode, run it again and
156
00:12:59,390 --> 00:13:02,410
it should now go through without a problem.
157
00:13:02,420 --> 00:13:10,390
Now the final thing we have to do here in Xcode, is to create a unique bundle I.D. That means you have
158
00:13:10,390 --> 00:13:17,260
to make sure you've got the Runner app selected, you're inside the targets of runner,
159
00:13:17,320 --> 00:13:20,830
you've got general selected, and this is your bundle identifier.
160
00:13:21,280 --> 00:13:25,810
So here we've got our domain here appbrewere.co reversed.
161
00:13:25,930 --> 00:13:31,960
So usually what we tell students is to write com, and then write your name, and then it should have .
162
00:13:32,050 --> 00:13:33,630
the name of the app.
163
00:13:33,670 --> 00:13:34,490
And this,
164
00:13:34,630 --> 00:13:38,910
hopefully nobody with your full name is trying to release an app called 'I Am Rich'
165
00:13:38,920 --> 00:13:42,610
onto the app store. And this will work just fine.
166
00:13:42,610 --> 00:13:48,730
Now if you don't have this unique, usually you'll have a little red warning around here, and it will not
167
00:13:48,730 --> 00:13:52,760
let you run your app until you fix this.
168
00:13:52,990 --> 00:13:59,770
So after all of those steps, we're finally ready to tackle the very last one, which is being able to
169
00:13:59,770 --> 00:14:02,650
run your app from Android Studio.
170
00:14:02,980 --> 00:14:09,910
So head back into Android Studio, and at this point before we try and run our app on our physical iPhone,
171
00:14:10,240 --> 00:14:15,830
it's a good idea to run a final check just to make sure that everything is setup correctly.
172
00:14:15,850 --> 00:14:21,430
For that, we will use our Flutter Doctor. The Flutter Doctor will let us know if there was anything we
173
00:14:21,430 --> 00:14:27,420
missed during the setup process. So go into Tools, and then under Flutter, select Flutter
174
00:14:27,440 --> 00:14:35,690
Doctor. And now it will run the Flutter Doctor diagnostics, and it'll show you what are the things that you've
175
00:14:35,690 --> 00:14:36,510
completed,
176
00:14:36,530 --> 00:14:43,940
what are the things that might still be yet incomplete, and if you see any of these points as a cross,
177
00:14:44,270 --> 00:14:53,120
then it usually includes a link to a documentation on Flutter's docs to tell you how you can fix it. But
178
00:14:53,120 --> 00:15:01,010
now that I've got ticks all across the board, you should see your phone being listed inside this drop down
179
00:15:01,010 --> 00:15:08,210
list, and from now on, every time it's plugged in, you'll see it show up as a potential deployment target,
180
00:15:08,240 --> 00:15:13,520
so you'll be able to run your apps onto your phone, without ever having to do all of the setup that we
181
00:15:13,520 --> 00:15:14,910
did before.
182
00:15:14,930 --> 00:15:21,470
So with our device listed in the dropdown and no issues detected by the Flutter Doctor, we're finally
183
00:15:21,470 --> 00:15:30,640
ready to hit play and run our app on our physical device. And now you can see that the app has been installed
184
00:15:30,700 --> 00:15:37,990
onto my physical device, and it will launch automatically, without you having to click on the app icon.
185
00:15:38,080 --> 00:15:42,340
And is actually quite important that you don't click on the app icon, because that will usually launch
186
00:15:42,370 --> 00:15:43,870
the previous version of your app.
187
00:15:43,870 --> 00:15:52,120
So just wait for Android Studio and Flutter to kickstart the app. And now I have my 'I Am Rich' app running
188
00:15:52,180 --> 00:16:00,530
on my physical iOS device. So there's quite a few steps involved in doing this and there's quite a few
189
00:16:00,530 --> 00:16:02,490
places that students fall down on.
190
00:16:02,510 --> 00:16:09,320
So we've compiled a list for you to troubleshoot any problems you have and just check that you've completed
191
00:16:09,350 --> 00:16:13,790
all of the steps. So that we'll be in the course resources under this module.
192
00:16:13,940 --> 00:16:19,060
And if you have any problems getting up to here, then be sure to check that out.
193
00:16:19,080 --> 00:16:22,970
Now once you already, head over to the next module, and we're going to be building another app.
21157
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.