1
00:00:07,120 --> 00:00:12,280
Hey everybody what's going on says Caleb with Dev slopes com and in this video we're going to talk about

2
00:00:12,280 --> 00:00:14,620
how do we handle a successful purchase.

3
00:00:14,620 --> 00:00:18,520
How do we handle a failure payment deferred et cetera et cetera.

4
00:00:18,550 --> 00:00:23,080
How are we going to manage that and how are we going to notify our application that these certain things

5
00:00:23,080 --> 00:00:23,990
have happened.

6
00:00:24,010 --> 00:00:28,590
We're going to dive into it right now and let's pull open our project and let's check it out.

7
00:00:28,600 --> 00:00:34,370
So to begin we're actually going to need to go into our IAP service so click on that.

8
00:00:34,540 --> 00:00:40,240
And then inside of the IAP service what we're going to do is we're going to scroll down to where we

9
00:00:40,240 --> 00:00:42,760
basically handle our payment request.

10
00:00:42,760 --> 00:00:49,490
So scroll down all the way here to where we basically conform to S-K payment transaction observer.

11
00:00:49,570 --> 00:00:54,460
Now inside of the payment queue we go through a switch for the transaction state.

12
00:00:54,460 --> 00:00:59,770
So let's say that I attempted to purchase something and the purchase failed maybe I canceled the purchase.

13
00:00:59,770 --> 00:01:02,320
Maybe my phone crashed or something.

14
00:01:02,320 --> 00:01:07,330
What it's going to do is it's going to switch through it's going to go ahead and go to Case whoops case

15
00:01:07,330 --> 00:01:08,320
failed.

16
00:01:08,320 --> 00:01:14,050
It's going to finish the transaction and send a notification for failed and that this is a very important

17
00:01:14,050 --> 00:01:14,440
function.

18
00:01:14,440 --> 00:01:15,780
I'm going to show you this now.

19
00:01:15,970 --> 00:01:18,290
So it's down at the very bottom of the View Controller.

20
00:01:18,400 --> 00:01:26,170
And here we have send notification for status and that comes from purchase status which is another enumeration

21
00:01:26,470 --> 00:01:34,870
now purchased restored and failed are three different ways that we can basically say hey we purchased

22
00:01:34,870 --> 00:01:40,150
something we restored something or we failed something but we're going to actually add a fourth case

23
00:01:40,240 --> 00:01:44,720
here and we're going to add case subscribed because that's another thing.

24
00:01:44,800 --> 00:01:49,120
If we purchase the food item that's one thing but subscribing is entirely different.

25
00:01:49,120 --> 00:01:53,410
So we're going to set another case here to be able to differentiate those different things.

26
00:01:53,410 --> 00:01:58,390
Now let's go back to IP service and you're going to notice if I build this it's going to say this switch

27
00:01:58,420 --> 00:02:03,840
is not exhaustive and that's because we're not handling what happens in the instance of a subscription.

28
00:02:04,030 --> 00:02:12,090
So go ahead and call case dot and look at that subscriber shows up put a call in and press enter.

29
00:02:12,100 --> 00:02:14,800
And now this is where all the good stuff is going to happen.

30
00:02:14,800 --> 00:02:20,410
For now we're just going to break but we're going to go ahead and add a custom notification here that

31
00:02:20,410 --> 00:02:24,670
will be posted as soon as a subscription successfully happens.

32
00:02:24,670 --> 00:02:25,260
OK.

33
00:02:25,570 --> 00:02:31,480
So you'll notice that there are some constants here that are saved IAP service purchase notification

34
00:02:31,810 --> 00:02:35,380
IAP service restore an IP service failure.

35
00:02:35,380 --> 00:02:40,120
Now if you go into constants and take a look you'll notice that I've just saved these here to have the

36
00:02:40,120 --> 00:02:41,710
same string value.

37
00:02:41,710 --> 00:02:45,670
Now we're going to go ahead and create another one for what happens if we subscribe.

38
00:02:45,670 --> 00:02:47,800
That means our subscription information has changed.

39
00:02:47,800 --> 00:02:50,110
Either we have subscribed we haven't.

40
00:02:50,110 --> 00:02:52,660
Maybe our subscription expired et cetera et cetera.

41
00:02:52,660 --> 00:03:04,720
So go ahead and type let IAAPA service subscribed status changed notification.

42
00:03:05,110 --> 00:03:08,300
That's super long Let's just say.

43
00:03:09,950 --> 00:03:13,330
IAP sub info changed.

44
00:03:13,340 --> 00:03:14,410
That's a little better.

45
00:03:14,780 --> 00:03:21,800
Press equals and go ahead and create a string of the same name IAP sub info change notification and

46
00:03:21,860 --> 00:03:23,420
let's leave it at that.

47
00:03:23,420 --> 00:03:32,720
So back into the IP service we're going to go ahead and call notification center like so default will

48
00:03:32,720 --> 00:03:36,850
access the default notification center and we're going to post a notification.

49
00:03:36,880 --> 00:03:43,700
Okay so go ahead and type post and we're going to choose the one with the name and an object.

50
00:03:43,920 --> 00:03:44,210
Okay.

51
00:03:44,210 --> 00:03:48,710
So go ahead and type an s notification

52
00:03:51,680 --> 00:03:59,790
name and then inside the parentheses we're going to call IAP and it's going to be not available because

53
00:03:59,790 --> 00:04:01,070
we've not built it yet.

54
00:04:01,230 --> 00:04:04,490
IAP sub There it is.

55
00:04:04,500 --> 00:04:07,560
IAP sub info changed notification.

56
00:04:07,560 --> 00:04:10,440
Now the object is actually going to be a boolean.

57
00:04:10,500 --> 00:04:11,040
OK.

58
00:04:11,340 --> 00:04:17,580
And the reason for that being is we're either going to say are we subscribed or are we not.

59
00:04:17,610 --> 00:04:20,620
Or maybe is our subscription valid or is it expired.

60
00:04:20,820 --> 00:04:26,100
And so what I'm going to do is I'm actually going to modify my function here because if you look we

61
00:04:26,100 --> 00:04:31,140
can pass in a status which is mandatory and an identifier which is optional.

62
00:04:31,140 --> 00:04:37,140
The reason for that is because if our payment is restored it doesn't matter what it was it's just going

63
00:04:37,140 --> 00:04:39,010
to restore everything that we've already bought.

64
00:04:39,210 --> 00:04:43,920
If it's failed it doesn't matter what object it came from because we just need to know that the payment

65
00:04:43,920 --> 00:04:44,610
failed.

66
00:04:44,730 --> 00:04:49,310
If we're subscribed we need to know is it valid or is it expired.

67
00:04:49,320 --> 00:04:52,890
And so we're going to use a boolean but we're not currently passing in a boolean.

68
00:04:53,040 --> 00:04:55,880
So we're going to add a new property here.

69
00:04:56,160 --> 00:05:02,730
So we're going to say send notification for status with identifier or Boullion and we're going to use

70
00:05:02,730 --> 00:05:05,950
bhool as an internal parameter of type Boolean.

71
00:05:06,260 --> 00:05:06,810
OK.

72
00:05:07,080 --> 00:05:10,060
Now pass in Bhool as the object here.

73
00:05:10,380 --> 00:05:15,630
And that is what we're going to use to to post our subscription notification.

74
00:05:15,630 --> 00:05:16,580
It's pretty cool.

75
00:05:16,890 --> 00:05:18,690
Now you're going to notice some issues.

76
00:05:18,720 --> 00:05:24,930
It's going to say that we are missing some arguments and we are because we're calling send notification

77
00:05:24,930 --> 00:05:25,790
right here.

78
00:05:26,100 --> 00:05:31,920
Now of course we are calling it where we are making our purchase and this is another thing we need to

79
00:05:31,920 --> 00:05:34,970
think about when we send the notification.

80
00:05:34,980 --> 00:05:40,470
This is for only a purchase but how are we going to differentiate between a purchase of a subscription

81
00:05:40,560 --> 00:05:43,780
and a purchase of just like a meal or hide ads.

82
00:05:43,980 --> 00:05:44,450
To do that.

83
00:05:44,450 --> 00:05:48,450
We're actually going to get rid of this function and put it inside the complete function.

84
00:05:48,450 --> 00:05:55,130
So go ahead and cut this like so and then go find the complete function like so.

85
00:05:55,310 --> 00:05:55,600
OK.

86
00:05:55,710 --> 00:05:57,620
Check it out inside.

87
00:05:57,760 --> 00:05:58,820
Complete.

88
00:05:58,980 --> 00:06:06,200
We're going to go ahead and use our switch to find either our hide adds ID or our subscription ID.

89
00:06:06,420 --> 00:06:12,830
So I'm going to add a new case right at the top case IAP mealtime monthly sub.

90
00:06:13,020 --> 00:06:17,270
OK because remember these are all for the product identifier on iTunes Connect.

91
00:06:17,460 --> 00:06:20,000
So go ahead and put a colon press enter.

92
00:06:20,010 --> 00:06:25,200
And what we're going to do is we're going to go ahead and basically copy and paste in what we just copied

93
00:06:25,200 --> 00:06:28,850
from above which is send notification for status purchased.

94
00:06:28,860 --> 00:06:31,170
But remember this is a subscription.

95
00:06:31,170 --> 00:06:35,330
And we have a special identifier just for that.

96
00:06:35,430 --> 00:06:37,490
We have dot subscribed.

97
00:06:37,710 --> 00:06:41,910
OK Bill to make sure that that's good to go and it's going to say we're missing a parameter which we

98
00:06:41,910 --> 00:06:43,430
are so click fix.

99
00:06:43,680 --> 00:06:51,780
And remember for our mealtime monthly sub if we are successful what we need to be doing is we basically

100
00:06:51,780 --> 00:06:52,560
need to pass in.

101
00:06:52,560 --> 00:06:53,080
True.

102
00:06:53,100 --> 00:06:55,900
Right because we are successful we did buy it.

103
00:06:56,040 --> 00:07:01,590
And so then it's going to go ahead and pass in that bullion as the notifications object which is awesome.

104
00:07:01,830 --> 00:07:07,230
Now at the very end since we're in a switch we need to break so that it knows to get out of it and then

105
00:07:07,230 --> 00:07:13,230
we also need to think if we are purchasing something we need to send a notification that this meal has

106
00:07:13,230 --> 00:07:16,750
been purchased so we can put that in IAP meal ID.

107
00:07:17,040 --> 00:07:20,840
And this one works right because we are sending it in as a purchase.

108
00:07:20,850 --> 00:07:22,200
Very very cool.

109
00:07:22,680 --> 00:07:23,880
So that should be good.

110
00:07:23,880 --> 00:07:25,640
We need to add our identifier here.

111
00:07:25,650 --> 00:07:28,410
And for this one we don't need to pass in a boolean.

112
00:07:28,410 --> 00:07:31,130
So let's just say nil we don't need it.

113
00:07:31,290 --> 00:07:32,970
Very very cool.

114
00:07:32,970 --> 00:07:36,820
So let's think what do we need to do next.

115
00:07:36,840 --> 00:07:38,910
We need to make sure that all our errors are gone.

116
00:07:39,040 --> 00:07:42,090
OK so click fix for restored.

117
00:07:42,090 --> 00:07:45,460
This is what is called After we successfully restore everything.

118
00:07:45,660 --> 00:07:52,140
We're going to send the restored notification with no identifier and no booleans so passen Nelle we

119
00:07:52,140 --> 00:07:53,300
have to fix this.

120
00:07:53,310 --> 00:07:58,740
It's going to say nyl is not compatible with argument type bool.

121
00:07:58,740 --> 00:08:00,510
Why is that.

122
00:08:00,990 --> 00:08:07,110
Oh that's because we didn't make this optional whoops that should be optional and this may ask us to

123
00:08:07,110 --> 00:08:08,520
force enwrap.

124
00:08:08,800 --> 00:08:09,570
I don't believe it will.

125
00:08:09,570 --> 00:08:10,130
OK.

126
00:08:10,530 --> 00:08:16,290
So missing argument let's add it in let's see failed does not matter.

127
00:08:16,480 --> 00:08:24,160
So put in nil and now it looks like we are doing pretty good here so we make a purchase.

128
00:08:24,240 --> 00:08:30,960
The purchase is finished we call comp. And based on that we send a notification saying hey we successfully

129
00:08:30,960 --> 00:08:31,620
subscribed.

130
00:08:31,620 --> 00:08:33,230
Very very cool.

131
00:08:33,390 --> 00:08:35,070
But there's something else.

132
00:08:35,100 --> 00:08:40,130
Remember a subscription had a perk it automatically hid the ads for us.

133
00:08:40,140 --> 00:08:46,890
So what we're going to do is we're going to also call set non consumable purchase to be true when we

134
00:08:46,890 --> 00:08:47,850
make a subscription.

135
00:08:47,850 --> 00:08:54,550
So go ahead and actually we're going to copy this like so and we're going to go ahead and paste it beneath.

136
00:08:54,600 --> 00:08:58,110
So we're doing both We're sending a notification for scription.

137
00:08:58,120 --> 00:09:01,920
We're also setting the non consumable purchase to be true.

138
00:09:02,050 --> 00:09:02,690
OK.

139
00:09:03,010 --> 00:09:03,960
Very very cool.

140
00:09:04,150 --> 00:09:05,860
So that's awesome.

141
00:09:06,160 --> 00:09:06,640
Let's think.

142
00:09:06,640 --> 00:09:10,850
Is there anything else we should do we may have to come back and look at stuff later.

143
00:09:11,050 --> 00:09:12,550
But I think that's pretty good.

144
00:09:12,550 --> 00:09:17,440
When we when we subscribe we're going to send a notification we're going to set that non consumable

145
00:09:17,440 --> 00:09:19,060
purchase to be true.

146
00:09:19,240 --> 00:09:24,830
And we're basically going to be able to hide the ads when we subscribe which is very very cool.

147
00:09:24,850 --> 00:09:30,460
So let's go ahead and let's set up an observer for this notification so we can see if it's actually

148
00:09:30,460 --> 00:09:32,240
working when we make a subscription.

149
00:09:32,290 --> 00:09:37,510
So go ahead and head into storefront Visi because that's where our subscribed button is and click on

150
00:09:37,510 --> 00:09:37,940
it.

151
00:09:37,990 --> 00:09:43,990
And then what we're going to do is in view did load We're going to set up another notification observer

152
00:09:43,990 --> 00:09:44,760
here.

153
00:09:44,770 --> 00:09:51,370
Now this one is for when a purchase is restored and as you can see when show restored alert is called

154
00:09:51,370 --> 00:09:55,800
it presents an alert basically saying hey your purchases were successfully restored.

155
00:09:56,110 --> 00:10:00,760
We're going to basically set up a function that will be able to determine whether or not we are valid

156
00:10:00,790 --> 00:10:02,100
in our subscription.

157
00:10:02,230 --> 00:10:08,630
So to do this let's create another observer by typing notification center default.

158
00:10:08,810 --> 00:10:15,730
Our observer can we're going to choose the one here with an observer selector name an object and the

159
00:10:15,730 --> 00:10:20,910
observer is self or this view controller the selector will come back to in a second.

160
00:10:21,070 --> 00:10:24,720
The name we're just going to use an S notification name.

161
00:10:24,790 --> 00:10:29,680
But then in parentheses following it we're going to put in our subscription notification because that's

162
00:10:29,680 --> 00:10:31,990
the one that gets posted when we subscribe.

163
00:10:32,020 --> 00:10:39,070
So type IAP sub info change notification and the object we can just say it's nil because that will actually

164
00:10:39,070 --> 00:10:41,560
be passed through in the next notification.

165
00:10:41,890 --> 00:10:47,890
So for the selector we need to write a function that will do a certain behavior or perform a certain

166
00:10:47,890 --> 00:10:50,800
action whenever that notification is posted.

167
00:10:50,800 --> 00:10:59,800
So let's actually write that function now by typing phunk subscription status was changed.

168
00:11:00,570 --> 00:11:01,500
OK.

169
00:11:01,630 --> 00:11:04,560
And basically we need to think what are we going to do here.

170
00:11:04,750 --> 00:11:06,700
We get a value passed in.

171
00:11:06,730 --> 00:11:13,150
If you remember when we subscribe we pass in a boolean either true or false.

172
00:11:13,270 --> 00:11:19,330
And that is accessible to us in the notification that's sent now to access that what we can do is we

173
00:11:19,330 --> 00:11:24,110
can go ahead and set up a parameter of type notification.

174
00:11:24,160 --> 00:11:27,930
So to do that I'm just going to put an underscore because the name doesn't really matter.

175
00:11:28,120 --> 00:11:31,940
But I am going to give an internal parameter of notification.

176
00:11:32,540 --> 00:11:35,650
OK and that's going to be of type notification like I said.

177
00:11:36,040 --> 00:11:41,950
Now in order to actually access the object of bullion that's passed in we can go ahead and create a

178
00:11:41,950 --> 00:11:46,000
constant that pulls out the object from the notification.

179
00:11:46,060 --> 00:11:54,480
So to be safe I'm going to use guard Latt by typing guard let let's just say status equals notification.

180
00:11:54,640 --> 00:11:57,490
OK the one we passed in object.

181
00:11:57,520 --> 00:12:00,580
Check that out as a boolean.

182
00:12:00,730 --> 00:12:06,100
OK but since this is a guard but we need to provide another option so else meaning if that doesn't work

183
00:12:06,160 --> 00:12:09,850
if we don't get a value we're just going to return get out of this function.

184
00:12:09,850 --> 00:12:11,000
Keep us from crashing.

185
00:12:11,140 --> 00:12:11,810
OK.

186
00:12:12,100 --> 00:12:12,960
So that's great.

187
00:12:12,970 --> 00:12:19,230
But otherwise we will have a boolean value in this status and we can basically create two conditions

188
00:12:19,450 --> 00:12:23,700
if status is true do one thing if status is not true do another thing.

189
00:12:23,840 --> 00:12:28,000
Let's set that up if status is true.

190
00:12:30,350 --> 00:12:31,660
Else.

191
00:12:32,180 --> 00:12:39,370
And this is where we're going to perform actions for success with let's say active subscription

192
00:12:42,560 --> 00:12:48,620
and this is where we're going to go ahead and perform actions for expired subscription and we'll get

193
00:12:48,620 --> 00:12:49,570
to that in a moment.

194
00:12:49,730 --> 00:12:54,120
But for now let's see what can we do we could print.

195
00:12:54,140 --> 00:13:02,730
Let's go ahead and call de-bug print and we'll just say subscription valid.

196
00:13:03,080 --> 00:13:03,920
OK.

197
00:13:04,580 --> 00:13:10,450
And for expired we'll say subscription expired and there is that.

198
00:13:10,460 --> 00:13:11,610
That's our function.

199
00:13:11,630 --> 00:13:16,220
But we're getting an error up here or we will if we try to build saying that we have you know a blank

200
00:13:16,260 --> 00:13:18,790
boiler plate code still sitting in there.

201
00:13:19,100 --> 00:13:22,180
And so to do that we're going to type LB selector.

202
00:13:22,550 --> 00:13:27,140
And if you know anything about selectors we can just pass in the name of a function and that basically

203
00:13:27,140 --> 00:13:29,810
sets it up to call a certain function for us.

204
00:13:29,810 --> 00:13:33,980
So that function is subscription status was changed.

205
00:13:33,980 --> 00:13:39,150
Press enter and the cool thing is that remember that this parameter here is of type notification.

206
00:13:39,320 --> 00:13:42,780
It'll automatically get passed in thanks to notification center.

207
00:13:42,830 --> 00:13:49,130
Now it's giving us an error saying that the argument Selecta refers to instance method that's not exposed

208
00:13:49,130 --> 00:13:50,250
to Objective-C.

209
00:13:50,450 --> 00:13:51,360
Click Fix.

210
00:13:51,370 --> 00:13:53,550
And what that's going to do.

211
00:13:53,660 --> 00:13:55,150
Whoops there we go.

212
00:13:55,160 --> 00:14:01,130
It's basically going to add at BJC to the front of our function just exposing it to the object C code

213
00:14:01,130 --> 00:14:03,960
that X code needs to process this.

214
00:14:03,980 --> 00:14:05,660
So that was a lot of code.

215
00:14:05,660 --> 00:14:07,060
Let's go ahead and build and run this.

216
00:14:07,070 --> 00:14:12,860
And let's go see if this fixed are not fixed but let's see if when we subscribe if the notification

217
00:14:12,890 --> 00:14:14,800
is successfully sent.

218
00:14:14,990 --> 00:14:17,310
Ok so I'm going to go ahead and build and run this.

219
00:14:17,330 --> 00:14:20,330
I'm going to go ahead and show you my simulator device.

220
00:14:20,630 --> 00:14:22,070
And here we go.

221
00:14:22,220 --> 00:14:30,970
So you can see this I can see this when I tap on the dollar sign like so it asks for our password so

222
00:14:30,970 --> 00:14:31,860
let's type that in.

223
00:14:31,860 --> 00:14:34,620
Test test one two three exclamation mark

224
00:14:37,610 --> 00:14:43,960
OK so it says subscribe to meal plan this subscription will automatically renew every month for forty

225
00:14:43,960 --> 00:14:45,700
nine ninety nine.

226
00:14:45,700 --> 00:14:46,780
Press continue.

227
00:14:47,830 --> 00:14:52,960
And it says this subscription will continue unless cancelled in settings at least one day before a subscription

228
00:14:52,960 --> 00:14:54,180
period ends.

229
00:14:54,190 --> 00:15:01,980
Press OK and when we press OK it should purchase OK so when we purchased it boom we finished the transaction.

230
00:15:01,990 --> 00:15:04,780
We call complete complete is here.

231
00:15:04,900 --> 00:15:05,280
OK.

232
00:15:05,290 --> 00:15:11,640
It will be IAP monthly sub meaning we'll send our notification and we will set our purchase to be true

233
00:15:11,650 --> 00:15:19,540
so the ads should go away now send notification for subscribed is going to post our notification which

234
00:15:19,600 --> 00:15:24,500
in storefront Visi we have an observer for that notification.

235
00:15:24,730 --> 00:15:29,520
When something is sent using that notification we're going to pass it in here.

236
00:15:29,680 --> 00:15:34,690
If it's true meaning if the subscription is true we're going to get subscription valid.

237
00:15:34,690 --> 00:15:36,970
Otherwise we'll get subscription expired.

238
00:15:37,000 --> 00:15:38,560
So go ahead and push.

239
00:15:38,560 --> 00:15:39,880
OK.

240
00:15:40,720 --> 00:15:43,820
And let's see if we get a nice little print statement here.

241
00:15:44,450 --> 00:15:46,780
I pushed OK sorry you couldn't see that on my screen.

242
00:15:46,800 --> 00:15:50,610
But all that happened was it popped up saying your purchase was successful.

243
00:15:50,610 --> 00:15:53,880
We get a notification saying subscription valid check that out.

244
00:15:53,880 --> 00:15:55,080
That's cool.

245
00:15:55,080 --> 00:16:03,010
And we also got our success message from our IP service which is right here purchased was successful.

246
00:16:03,150 --> 00:16:04,690
That is so cool.

247
00:16:04,830 --> 00:16:11,160
And now if I rebuild my app you'll notice that my subscription is still valid.

248
00:16:11,160 --> 00:16:15,680
Now if I pull up one of the controllers you'll notice the ads are gone.

249
00:16:15,750 --> 00:16:23,310
It successfully saved so remember we set our non-consumer consumable purchase to be true and that basically

250
00:16:23,490 --> 00:16:29,130
went into user defaults and it set true for our non consumable purchase was made.

251
00:16:29,250 --> 00:16:32,530
And that's going to basically allow us to hide those ads.

252
00:16:32,550 --> 00:16:40,800
OK because in detail we see we have a variable called Hidden status that gets its value from that exact

253
00:16:40,860 --> 00:16:47,310
same user defaults boolean and we use that to basically determine whether or not the ads should show

254
00:16:47,310 --> 00:16:48,360
or hide.

255
00:16:48,380 --> 00:16:51,180
OK that's pretty cool.

256
00:16:51,180 --> 00:16:54,260
So let's think what can we do next.

257
00:16:54,270 --> 00:16:59,770
What can we do to you know show that this is an ad subscription that we have a valid subscription.

258
00:17:00,000 --> 00:17:04,050
Let's go ahead and let's think I'm going to actually go to my storyboard and we're going to brainstorm

259
00:17:04,140 --> 00:17:09,480
what we can do to actually show whether or not this is a valid subscription.

260
00:17:09,480 --> 00:17:13,950
And I think what I want to do actually is I want to put a label here that says subscription valid or

261
00:17:13,950 --> 00:17:15,080
subscription expired.

262
00:17:15,090 --> 00:17:17,710
So let's drag that on really fast.

263
00:17:17,860 --> 00:17:24,660
You can't type you label drag it on and make sure that it does not touch the collection view.

264
00:17:24,690 --> 00:17:27,930
But it goes below like like that and I'm going to drag it.

265
00:17:27,930 --> 00:17:31,270
So it's nice and big 50 points high.

266
00:17:31,590 --> 00:17:37,710
And let's go ahead and let's pin that to the left bottom and right and give it a fixed height of 50.

267
00:17:37,710 --> 00:17:41,520
There we go Center the font and change it to Avenir next.

268
00:17:41,550 --> 00:17:42,990
That's my favorite font.

269
00:17:42,990 --> 00:17:44,180
I mean you can use whatever you want.

270
00:17:44,190 --> 00:17:50,160
But anyway and I'm going to bump it up to 24 and set it to be bold.

271
00:17:50,430 --> 00:17:51,310
OK.

272
00:17:51,390 --> 00:17:54,180
Now this will say updating.

273
00:17:54,750 --> 00:17:59,820
And basically depending on whether or not our subscription is active or expired we're going to set it

274
00:17:59,820 --> 00:18:02,390
so that it changes the font and color accordingly.

275
00:18:02,610 --> 00:18:07,740
Now Black is pretty intense of a color here so I think what I'm actually going to do is I'm actually

276
00:18:07,740 --> 00:18:09,770
going to choose a nice dark gray.

277
00:18:09,930 --> 00:18:11,530
That's a little less intense.

278
00:18:11,610 --> 00:18:15,020
I chose tungsten or if you want to know it's just six threes.

279
00:18:15,150 --> 00:18:16,210
That's pretty cool.

280
00:18:16,500 --> 00:18:21,390
So there we go our updating label is here but we should connect this to The View Controller so that

281
00:18:21,390 --> 00:18:28,470
we can properly update the label and we need to so open the assistant editor here and go ahead and pull

282
00:18:28,530 --> 00:18:38,070
up to the top right click on the label and drag it here and we're going to say subscription subscription

283
00:18:38,130 --> 00:18:42,650
status label.

284
00:18:42,840 --> 00:18:43,920
Press connect.

285
00:18:43,950 --> 00:18:46,740
And now we have access to that label.

286
00:18:46,870 --> 00:18:48,850
It will show updating by default.

287
00:18:48,990 --> 00:18:52,830
And now we're going to move on and head over to the next video where we're going to start customizing

288
00:18:52,890 --> 00:18:58,920
the experience of our app as well as preventing users from stealing this subscription.

289
00:18:59,160 --> 00:19:03,390
If you know anything about the jailbreak scene with iPhones there are ways to get around paying for

290
00:19:03,390 --> 00:19:04,350
in-app purchases.

291
00:19:04,440 --> 00:19:08,990
But we're going to make sure that people cannot do that by verifying the receipt with Apple.

292
00:19:09,000 --> 00:19:10,030
Very very cool.

293
00:19:10,140 --> 00:19:14,880
Let's head over to the next video and let's start doing that right now.
