Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Debugging the iOS App4:59 with Heath Hodgert
We'll first discuss how to setup your Mac and the required software. When your Mac is set up we will connect from Visual Studio for Windows and launch our app. Then we'll discuss the benefits and drawbacks of the iOS simulator.
We learned about Visual Studio for Mac earlier, so your Mac should be all setup. 0:00 We also should have our Mac Agent setup for when we worked on the IOS storyboard. 0:05 With the Mac Agent connected, 0:11 we can test it out by showing the simulator from the Tools menu under iOS. 0:13 You'll see the default simulator pop up on your Mac. 0:18 While we're here, we'll look at some of the other tools for iOS. 0:22 The other tools for iOS are the Device Log, can display 0:26 all activity on a physical device, even if you're not debugging the app. 0:30 The Mac Agent Console allows for more complex interactions with the Mac Agent. 0:36 We won't be using it in this course. 0:44 Now, we can launch our app in iOS using the simulator. 0:47 The first step is to set the startup project to the iOS PizzaCalculator. 0:52 You can do it by right-clicking and setting as StartUp Project. 0:58 Or you can choose the startup project from the toolbar. 1:05 Just like with Android, the Debug Run button has a drop down to 1:09 select the device you want to run your app on. 1:13 Doesn't matter which on you choose, 1:16 although I use a phone to save screen real estate. 1:18 Click the Debug button and our app should launch. 1:22 So our app launched, but 1:35 we get a error message saying that the PizzaCalculator.iOS needs to be updated. 1:36 Let's go take a look at how to fix it. 1:41 We'll stop our debug session. 1:44 In the properties for the IOS project, the current template uses i386, 1:49 but Apple has changed the requirements to only allow 64-bit instructions. 1:54 Select the supported architecture, 2:01 x86_64, and rebuild the project. 2:05 If you are using a device and selected the iPhone platform, 2:09 the supported architecture is ARM 7 plus ARM 64, 2:14 which is correct so you don't need to change it. 2:18 Now click the Debug button and switch to the emulator and watch our app. 2:23 Let's enter a value, calculate, and we get 11. 2:29 You may have discovered another thing that can be troublesome. 2:35 Once you enter the people count and tap the calculate button, 2:39 the keyboard does not go away. 2:42 The reason is that the text entry still has the focus, or 2:44 in Apple terms, first responder. 2:48 So, once you tap the button, we need the PeopleEntry to not be the first responder. 2:51 If we go back to the view controller we can add a line to the delegate, so 2:57 the PeopleEntry will resign first responder. 3:02 We'll stop our app, go to the view controller, 3:07 When we calculate, we want to resign first responder from the PeopleEntry. 3:15 Now when we run our app, The keyboard goes away. 3:28 Now let's stop debugging, And take a quick look at the configuration options. 3:34 Since we opened the preferences to set the supported architecture, 3:47 you can see that it's much more complicated than Android preferences. 3:51 I'll do a brief overview of the important preferences. 3:55 The iOS Build section, the SDK Version should be set to default, but 3:58 if you have an older or beta version selected here, 4:03 Linker Behavior is slightly different than Android. 4:07 Set Linker Behavior to Don't Link, will not link any libraries. 4:10 And Link Framework SDKs Only will link basic class libraries, 4:16 but no user assemblies. 4:22 Supported Architecture must be set to 64-bit for all new apps. 4:25 The iOS Debug and iOS On-Demand Resource sections are not important at this point. 4:30 The iOS Bundle section is important for publishing to stores, but 4:37 the automatic settings usually work for development. 4:41 None of the other sections are important at this time. 4:46 The Build, Build Events, and References Paths, and 4:50 Security are just like any other MS Build project and don't need to be changed. 4:53
You need to sign up for Treehouse in order to download course files.Sign up