Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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 Over 35 exciting recipes to spice up your application development with Ionic

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781785287978
Length 264 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Hoc Phan Hoc Phan
Author Profile Icon Hoc Phan
Hoc Phan
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Creating Our First App with Ionic FREE CHAPTER 2. Managing States and Navigation 3. Adding Device Features Support 4. Offline Data Storage 5. Handling Gestures and Events 6. App Theme Customization 7. Extending Ionic with Your Own Components 8. User Registration and Authentication 9. Saving and Loading Data Using Firebase 10. Finalizing Your Apps for Different Platforms Index

Viewing the app using Xcode for iOS

Depending on personal preference, you may find it more convenient to just deploy the app using ionic ios --device on a regular basis. This command line will push the app to your physical device connected via USB without ever running Xcode. However, you could run the app using Xcode (in Mac), too.

How to do it...

  1. Go to the /platforms/ios folder.
  2. Look for the folder with .xcodeproj and open in Xcode.
  3. Click on the iOS Device icon and select your choice of iOS Simulator.
    How to do it...
  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. 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 your code related to device features such as camera or maps. If you change code in the /www folder and want to run it again in Xcode, you have to do ionic build ios first, because the running code is in the Staging folder of your Xcode project:

There's more...

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 simple to enable this capability:

  1. Allow remote debugging for an iOS device by going to Settings | Safari | Advanced and enable Web Inspector.
    There's more...
  2. Connect the physical iOS device to your Mac via USB and run the app.
  3. Open the Safari browser.
  4. Select Develop, click on your device's name (or iOS Simulator), and click on index.html.
    There's more...

Note: If you don't see the Develop menu in Safari, you need to navigate to menu 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.

You have been reading a chapter from
Ionic Cookbook
Published in: Oct 2015
Publisher: Packt
ISBN-13: 9781785287978
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 $19.99/month. Cancel anytime