Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Ionic Cookbook

You're reading from   Ionic Cookbook Recipes to create cutting-edge, real-time hybrid mobile apps with Ionic

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher
ISBN-13 9781788623230
Length 390 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Indermohan Singh Indermohan Singh
Author Profile Icon Indermohan Singh
Indermohan Singh
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Creating Our First App with Ionic 2. Adding Ionic Components FREE CHAPTER 3. Extending Ionic with Angular Building Blocks 4. Validating Forms and Making HTTP Requests 5. Adding Animation 6. User Authentication and Push Notifications 7. Supporting Device Functionalities Using Ionic Native 8. Theming the App 9. Advanced Topics 10. Publishing the App for Different Platforms 11. Other Books You May Enjoy

Viewing the app using Xcode for iOS

You could run the app using Xcode (in Mac) as well.

How to do it...

  1. Go to the /platforms/ios folder.
  2. Look for the folder with .xcodeproj and open it in Xcode.
  3. Click on the iOS device icon and select your choice of iOS simulator:
  4. Click on the run button and you should be able to see the app running in
    the simulator.

There's more...

You can connect a physical device via a USB port and it will show up in the iOS Device list for you to pick it. Then, you can deploy the app directly on your device. Note that iOS Developer membership is required for this. This method is more complex than just viewing the app via a web browser.

However, it's a must when you want to test out your code regarding device features, such as cameras or maps. If you change the code in the /src folder and want to run it again in Xcode, you have to do Ionic Cordova build ios first, because the running code is in the Staging folder of your Xcode project, as illustrated:

For debugging, the Xcode console can output JavaScript logs as well. However, you could use the more advanced features of Safari's Web Inspector (which is similar to Google Chrome's Developer Tools) to debug your app. Note that only Safari can debug a web app running on a connected physical iOS device because Chrome does not support this on a Mac. It's easy to enable this capability, and it can be done with the following steps:

  1. Allow remote debugging for an iOS device by navigating to Settings | Safari | Advanced and enabling Web Inspector:
  2. Connect the physical iOS device to your Mac via USB and run the app
  3. Open the Safari browser
  4. Select Develop | your device's name or iOS Simulator | index.html, as shown:

If you don't see the Develop menu in Safari, you need to navigate to Preferences |Advanced and check on Show Develop menu in menu bar.

Safari will open a new console just for that specific device, just as it's running within the computer's Safari.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime