1
00:00:06,890 --> 00:00:12,450
Hey everybody this is Caleb with Debb slopes dot com and welcome to the in-app purchase target topic.

2
00:00:12,450 --> 00:00:18,770
I'm so stoked to teach you everything you need to know about consumable and non consumable in-app purchases.

3
00:00:18,780 --> 00:00:21,650
There's a lot to learn so we're going to dive right into it now.

4
00:00:21,690 --> 00:00:25,020
Let's go ahead and let's begin by actually creating our ex code project.

5
00:00:25,020 --> 00:00:28,970
So pull up an X code and we're going to dive right into it.

6
00:00:28,980 --> 00:00:32,780
Let's go ahead and just click on Create new X code project just like that.

7
00:00:32,850 --> 00:00:39,130
Choose a single view application and we're going to need to pay attention here to our product name.

8
00:00:39,300 --> 00:00:42,470
So I'm going to think what do I want to call this.

9
00:00:42,570 --> 00:00:46,020
I'm going to call it food Zilah just like that.

10
00:00:46,110 --> 00:00:52,140
And now our organization identifier has calmed down slopes and our bundle identifier is calm.

11
00:00:52,190 --> 00:00:53,810
Depth slopes that food Zilah.

12
00:00:53,880 --> 00:00:58,770
This of course is going to be different for you simply because you're going to have a different organization

13
00:00:58,770 --> 00:00:59,340
identifier.

14
00:00:59,340 --> 00:01:01,180
But we will need this later on.

15
00:01:01,200 --> 00:01:02,890
We're also going to need the product name.

16
00:01:03,180 --> 00:01:08,030
So let's go ahead leave everything until it and go ahead and click next.

17
00:01:08,040 --> 00:01:14,370
Just like that and I'm going to go ahead and just go ahead and save it here to my folder that I have

18
00:01:14,370 --> 00:01:15,480
used here.

19
00:01:15,480 --> 00:01:21,270
Beautiful save wherever and you'll see that it automatically manages all the signing for you which is

20
00:01:21,270 --> 00:01:23,100
going to come in handy.

21
00:01:23,160 --> 00:01:24,140
What else.

22
00:01:24,290 --> 00:01:25,910
Let's see we have everything here.

23
00:01:25,920 --> 00:01:28,960
Why don't we go ahead and add in our assets.

24
00:01:29,100 --> 00:01:33,840
So we're going to drop on the images we'll be using and you can download these from the source code.

25
00:01:33,840 --> 00:01:38,130
There's a little button with a folder and a little download icon if you tap on that.

26
00:01:38,130 --> 00:01:42,360
It will allow you to download those files or if you're on an iPhone you can airdrop them straight to

27
00:01:42,360 --> 00:01:42,900
your Mac.

28
00:01:42,900 --> 00:01:43,680
Pretty cool.

29
00:01:43,920 --> 00:01:46,680
So go ahead and drag in these image sets.

30
00:01:46,860 --> 00:01:49,040
And as you can see they all add in properly.

31
00:01:49,040 --> 00:01:54,090
We have a close button and we also have some pictures of food because in this course we're going to

32
00:01:54,090 --> 00:02:00,220
make a restaurant app that lets you basically go on choose a food item and you can buy it using it in

33
00:02:00,290 --> 00:02:01,680
that purchase.

34
00:02:01,680 --> 00:02:07,500
We're going to have ads displayed which will basically allow you to use a non consumable purchase to

35
00:02:07,500 --> 00:02:08,430
hide the ads.

36
00:02:08,430 --> 00:02:09,300
It's going to be pretty cool.

37
00:02:09,300 --> 00:02:14,490
That's a pretty common way that non consumables are used in consumer facing apps.

38
00:02:14,490 --> 00:02:18,530
So now that our assets are properly added Let's go ahead.

39
00:02:18,540 --> 00:02:23,850
I want to show you actually a demo of a finished version of food Zilah.

40
00:02:23,850 --> 00:02:26,880
So I'm going to go ahead and collapse this and pull open my simulator.

41
00:02:27,820 --> 00:02:28,350
All right.

42
00:02:28,360 --> 00:02:29,470
So here we go.

43
00:02:29,470 --> 00:02:34,170
There is my iPhone by the way for testing in-app purchases.

44
00:02:34,180 --> 00:02:39,000
Sometimes the simulator can be finicky sometimes it might work sometimes it might not work.

45
00:02:39,010 --> 00:02:43,320
So with that in mind I'm going to go ahead and show you this on my iPhone how it works.

46
00:02:43,320 --> 00:02:45,150
I have it set up right here in front of me.

47
00:02:45,190 --> 00:02:50,430
So in our app what you can do here is you can go ahead and select a food item you can see a picture

48
00:02:50,440 --> 00:02:55,360
its price its name and you also see an ad a very annoying ad mind you.

49
00:02:55,360 --> 00:03:00,690
Now if I wanted to go ahead and buy this salmon meal I could tap by item for 999 and of course it's

50
00:03:00,700 --> 00:03:05,410
going to ask for the password for my test account which will create those later on.

51
00:03:05,410 --> 00:03:12,310
Sandbox users are going to log in and it will present me with a pop up saying do you want to buy one

52
00:03:12,310 --> 00:03:13,940
meal for 999.

53
00:03:14,080 --> 00:03:20,710
If I tap by you'll see it will present me with your purchase was successful and it also presents hope

54
00:03:20,710 --> 00:03:21,220
you're hungry.

55
00:03:21,220 --> 00:03:22,600
You just bought a meal.

56
00:03:22,930 --> 00:03:25,150
There is a consumable purchase.

57
00:03:25,150 --> 00:03:25,810
So check it out.

58
00:03:25,810 --> 00:03:26,980
I can tap it again.

59
00:03:27,130 --> 00:03:30,420
I can buy it again over and over and over again your purchase was successful.

60
00:03:30,430 --> 00:03:33,090
But what if I wanted to remove these ads.

61
00:03:33,100 --> 00:03:40,540
All I need to do is tap on buy hide ads for 99 cents and this is an example of a non consumable in that

62
00:03:40,540 --> 00:03:41,590
purchase.

63
00:03:41,590 --> 00:03:46,330
If I tap buy it says hey you've already purchased this would you like to get it again for free.

64
00:03:46,360 --> 00:03:50,310
That's also a cool thing about non consumable purchases which we'll talk about later on.

65
00:03:50,650 --> 00:03:51,810
If I tap OK.

66
00:03:52,090 --> 00:03:54,160
It says your purchase was successful.

67
00:03:54,160 --> 00:03:55,090
And take a look.

68
00:03:55,120 --> 00:03:56,240
The ads are gone.

69
00:03:56,260 --> 00:04:00,630
The button is gone and we now have a clean ad for user experience.

70
00:04:00,640 --> 00:04:06,270
That's pretty cool and all but another thing I need to show you is restoring our purchases.

71
00:04:06,460 --> 00:04:12,890
Let's say we've already purchased the hiding adds functionality but maybe I got a new phone and I re

72
00:04:12,970 --> 00:04:19,420
download this app and boom the ads are back but with Restore we have the ability to restore those in-app

73
00:04:19,420 --> 00:04:23,860
purchases just like in many other apps you've probably used before.

74
00:04:23,860 --> 00:04:27,700
So I want to show you how that works but in order to do that I'm going to have to go ahead and uninstall

75
00:04:27,700 --> 00:04:31,240
this and then bring it back up so just a moment.

76
00:04:31,240 --> 00:04:31,620
All right.

77
00:04:31,620 --> 00:04:32,440
Here we go.

78
00:04:32,440 --> 00:04:33,520
So check it out guys.

79
00:04:33,520 --> 00:04:36,400
If I open up the app you'll see the ads are back.

80
00:04:36,400 --> 00:04:41,580
If I close it and I tap the restore button it's going to restore the purchases that I've already made.

81
00:04:41,590 --> 00:04:47,860
So when I tap restore and check it out if I go into Samman you'll see my purchases have been restored

82
00:04:47,860 --> 00:04:48,850
just like that.

83
00:04:48,880 --> 00:04:50,760
Super super cool.

84
00:04:50,770 --> 00:04:56,350
Now of course we are using user defaults to store the hidden and shown status of the ad.

85
00:04:56,350 --> 00:05:01,060
So if I go out and quit and come back in you'll notice the ads are still gone.

86
00:05:01,060 --> 00:05:03,020
Super super cool.

87
00:05:03,040 --> 00:05:04,730
So this is what we're going to build.

88
00:05:04,750 --> 00:05:09,040
We have now properly set up our X code project with our assets.

89
00:05:09,040 --> 00:05:13,130
We've also given it a name and we've paid attention to the special bundle identifier.

90
00:05:13,120 --> 00:05:18,130
So let's go ahead and head over to the next video where we're going to dive into iTunes Connect the

91
00:05:18,130 --> 00:05:23,230
place where we're going to create this on Apple's and their server and then link the two together.

92
00:05:23,260 --> 00:05:23,940
Very very cool.

93
00:05:23,950 --> 00:05:26,180
Let's go ahead and do it right now.
