Download the demo Xcode project from: http://db.tt/14dtriGU
SESSION ABSTRACT
You’ve been a .NET developer for the last 10 years. You love Visual Studio. You can spit out C# like a boy scout can tie a knot. But now your boss wants you to build an iPad app for the company. Or maybe you got a good deal on a Mac on eBay and you’ll finally write that cool iPhone app that will top the other 600K in the iOS App Store. So where do you get started? What development environment do you use? How do you write apps in Objective-C compared to C#? What other tools & libraries can you use? This session is your survival guide to the world of iOS development as seen from the eyes of a .NET developer. We’ll start from the basics and build our first iOS app, using analogies and comparisons from the familiar world of Visual Studio and .NET as our guide. We’ll also discuss how to structure our app project, how to test & deploy our app, and we’ll even take a quick look at some of the new developer features in iOS 7.
We'll also discuss how to cloud-enable your apps using Microsoft Azure Mobile Services, which features native support for iOS developers.
You’ll learn to blend in with the Apple crowd and talk like a true native in no time! If you’ve ever considered dipping your toes in the iWaters, this session is your chance to take your first dive.
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
iOS Development Survival Guide for the .NET Guy
1. iOS Development
Survival Guide for
the .NET Guy (Gal)
Nick Landry
Microsoft Senior Technical Evangelist
Nokia Developer Ambassador
nick.landry@microsoft.com
www.AgeofMobility.com
@ActiveNick
3. Disclaimers & Assumptions
• You know little to nothing about iOS development
• You’re a .NET developer: C# (or VB.NET), Visual Studio, XAML, ASP.NET,
Windows Forms, etc.
• You know some basics of Microsoft device development: Windows 8/RT
or Windows Phone
• You have access to a Mac, and preferably an iPad or iPhone too
• You want to learn the “native” iOS dev basics: Xcode & Objective C
– I am NOT covering mobile design considerations
– I am NOT covering Xamarin.iOS / MonoTouch, Appcelerator,
or Hybrid HTML5 App Development with PhoneGap
4. Agenda
• Overview of the Apple World
• How to Get Started with iOS Development
• Side-by-Side Comparisons: iOS vs. .NET
• Developing in Xcode vs. Visual Studio
• Simple Demo App + Sample Code
• iOS Frameworks
• Calling Cloud Services from iOS Apps
• iOS Developer Toolbox Recommendations
• iOS App Deployment
• Quick Tour of iOS 7 and Xcode 5
6. Overview of the Apple World
Recent Timeline
iPhone
iPod Touch
iPad
iPad Mini
Apple TV (2nd generation)
iOS 5.1.1 (Spring 2012)
iOS 6.0 (September 2012)
iOS 6.1 (January 2013)
iOS 7.0 (September 2013)
iOS 7.1
iOS Devices Latest iOS Versions
Jan 2007 – iPhone OS
Announcement
June 2007 – iPhone v1
Mar 2008 – App Store Beta
July 2008 – App Store
Launch
April 2010 – iPad v1
June 2010 – iPhone OS
renamed to iOS
October 2012 – iPad Mini
7. About Mac OS X
Cheetah Snow Leopard Lion Mountain Lion
Version 10.6
• Intel CPUs only
• Better performance
• New Finder
• Faster Safari Web
Browser
• Mac App Store
Version 10.7
• 64-bit CPUs only
• No more Rosetta
• More multi-touch
gestures
• Application resume
• Auto-save docs
• Launchpad
• Mission Control
Version 10.8
• Game Center
• iMessage
• Notification Center
• iWorks documents
in iCloud
Version 10.0
• Original release
• New Mac OS
• PowerPC CPUs only
• Slow & incomplete
• Transition to Intel
CPUs followed in
“Tiger” & “Leopard”
2001 2009 2011 2012
iOS is loosely based on Mac OS X
OS X: based on UNIX & NeXT tech
9. i.e. How to compete with 1,000,000 apps
iOS Development for iPhone & iPad
10. Getting Started with Native iOS Development
Get a Mac. iOS device
recommended too
• 2.5GHz Intel Core i5 Mac
Mini from $599 (new)
• 11-inch Intel Core i5 64GB
MacBook Air from $999
(new)
• Look for eBay Deals
Install Xcode
• Free download in the Mac
App Store
• Register an account at
developer.apple.com
• $99 / year to deploy to
actual devices & publish to
the App Store
Install Xamarin.iOS
• Aka “MonoTouch”
• Yes, you still need a Mac to
build iOS apps
• Free Starter Edition at
Xamarin.com
• $299 for Indie Edition: no
size limit + components
Install Other Tools
• UI Controls
• SDKs & Frameworks
• Dev Tools & IDEs
• Prototyping Tools
• Deployment Tools
• Start Learning!
11. Getting Started: .NET iOS
MICROSOFT .NET DEVELOPER APPLE IOS DEVELOPER
Computer Any Windows PC/laptop Mac
Dev Operating System Windows 8.1 Mac OS X
Official Resources MSDN Apple Developer Center
Development IDE Visual Studio Xcode
Development Languages C#, VB.NET, F#, etc. Objective-C
Primary SDK .NET Framework + WP SDK,
Windows 8.x SDK
iOS SDK
Code Compilation Managed Code Native Code
Runtime .NET CLR / WinRT No*
SDK Libraries .NET Assemblies Frameworks
User Interface XAML Controls Cocoa Touch Controls
Operating System Targets Win 8, Windows Phone iOS
Developer Program $19 per year $99 per year
Target Devices Lots of Diversity Few Options
14. Development IDE Comparison
MICROSOFT .NET DEVELOPER APPLE IOS DEVELOPER
IDE Visual Studio 2013 Xcode 5.x
Templates Yes Yes
Top Level of Hierarchy Solution Workspace
Application Projects Projects Projects
Class Files .cs .h, .m
Design Patterns Any / All MVC
Prevent Naming Collision Namespaces Prefixes
Device Emulation Emulator Simulator
Application Package .appx, .xap (package) .app (bundle)
Rearrange IDE Layout Yes No
Source Control TFS, Git, SVN, VSS, etc. Git, SVN
15. Objective C vs. C# - Sample Code
MICROSOFT .NET / C# DEVELOPER APPLE IOS OBJECTIVE-C DEVELOPER
ArrayList myList;
myList = new ArrayList();
myList.Add("Welcome! ");
int currentIndex = 0;
string message = myList.Item[currentIndex];
TextBox1.Text = message;
NSMutableArray *myList;
myList = [[NSMutableArray alloc] init];
[myList addObject:@"Welcome!"];
int currentIndex = 0;
NSString *message = [myList
objectAtIndex:currentIndex];
[textField setText:message];
16. iOS & the Model View Controller
• Using the MVC pattern is mandatory in Xcode for iOS projects based on UIKit
– No code behind. All code goes in Controller
– Apple decided for you. Don’t fight it
• Facilitates the development of Universal iOS apps for iPhone and iPad
• UIKit provides a system for navigating between Views and Controllers
– Includes Visual Transition
• Xcode provides drag & drop interactions
to connect Views and Controllers
– Actions and Outlets
18. Compilation & Memory Management
• Programming language (C#, VB.NET,
F#, etc.) compiled into Intermediate
Language (IL)
• IL compiled into native machine code
(x86 / x64) by the CLR
• Garbage Collection built-in and
automatically managed by the CLR
.NET iOS & Xcode
• Objective C compiled straight to native
machine code
• Previous version of Xcode used to give
developers compiler warnings about
refs
• Automatic Reference Counting (ARC)
provides a mechanism to help prevent
orphan objects & leaks
• ARC works at compile time, inserts the
Retain & Release code for you
19. Other Comparisons
MICROSOFT .NET DEVELOPER APPLE IOS DEVELOPER
Object Variables References Pointers
Object Creation new alloc and init
Object Initialization Constructors Initializers
Method Invocation Method Calling Message Passing
Relational Storage SQL CE, SQL Lite SQL Lite
Cloud Storage Azure Storage,
SQL Azure
iCloud Storage
20. Mobile Deployment
Microsoft .NET Developer Apple iOS Developer
Operating System Targets Windows 8.x, Windows Phone 8.x iOS
Developer Program $19 / year $99 / year
Target Devices Lots of Diversity Few Options
Deployment: Official Store Windows (Phone) Store App Store
Developer Unlock Device-level App-level
Deployment Package .appx, .xap (package) .app (bundle)
Deployment: Side-Loading Win7 / Win8.x Desktop only No
Enterprise Deployment Yes Yes
21. iOS Development: Default UIKit
• Push Buttons: Gradient, Rounded Rect, Textured, Recessed, Square, Round, Bevel, Pop Up, Inline
• Fields: Text, Search, Token, Secure, Masked, Wrapping
• Sliders: Horizontal, Vertical, Circular
• Progress Indicators: Indeterminate, Circular
• Formatters: Date, Number, Custom
• Label, Wrapping Label, Text View
• Combo Box, Date Picker, Check Box,
Radio Group
• Segmented, Image Well, Color Well,
Stepper, Level Indicator, Path Control
• Disclosure Triangle & Button,
Help Button
22. iOS Dev Toolbox – UI Controls
• Cocoa Controls (OSS & Commercial)
– www.cocoacontrols.com
• Maps
– Google Maps SDK for iOS
• http://developers.google.com/maps/documentation/ios
– Esri ArcGIS Map Control for iOS
• http://developers.arcgis.com/en/ios
– Bing Maps Controls for iOS
• www.microsoft.com/en-us/download/details.aspx?id=1112
• NucliOS – Commercial iOS Controls by Infragistics
– www.infragistics.com/ios
• Shinobi Controls – Commercial iOS Controls by VisiBlox
– www.shinobicontrols.com/ios
• Telerik – UI for iOS
– www.telerik.com/ios-ui
23. Popular Cocoa Controls
iCarousel ProgressView PDF Viewer Center Button DragKeyboard
AutoScroll Tab Bar Pull-to-Refresh Text Field Cell Alert Overlay
29. iOS Push Notifications
• Push (aka remote) notifications
– Introduced in iOS 3.0 & OS X version 10.7 (“Lion”)
– Apps must register to receive push notifications
– Apple Push Notification service (APNs) is required
– Require an SSL certificate per app from Dev Center
– Max size for notification payload is 256 bytes
• Local Notifications
– Introduced in iOS 4.0; not available in OS X
– Local notifications are scheduled by an app
• Local and push notifications look &
sound the same when shown
30. iOS Push: from Provider to Device
• Providers push to many devices
• Devices can receive push notifications from many providers
• APN Service includes
a default Quality of
Service (QoS)
component that
performs a
store-and-forward
function
31. • Hugely scalable push notifications
• Cross platform (including iOS & Android)
• Independent of storing data in cloud
• Push to a single user or millions
• Client and server registration
• Watch “Push Notifications to Any Client
with Notification Hubs”
– http://channel9.msdn.com/Events/Build/2014/2-616
Microsoft Azure Notification Hubs
APNs WNS
Notification Hub
App back-end
iOS app Windows app
MPNS
GCM
ADM
33. iOS Dev Toolbox – Deployment
• Use TestFlight as an alternative to enterprise deployment
• Free solution for prototype deployment & beta-testing
– Ideal when you don’t have an enterprise account
• Not a replacement for the App Store
• Simple Steps
– Sign-up & create a team
– Invite team members
– Testers accept email on their iOS device,
which leads them to register, install TestFlight app
– Upload your app to TestFlight
• Notifies users when a new build is up
• www.testflightapp.com
34. iOS Deployment with TestFlight
• Over-the-air
• Team Management
• Reports
• Crash Reports
• Feedback
35. What’s New in iOS v7
Consumer Features (available now)
• New Control Center (à la Android)
• Notification Center (new Today summary)
• New scheduled updates in apps
• New shooting formats and filters
• AirDrop sharing (to other iOS devices only)
• Safari – New gestures, full-screen mode, unified
search field, tab view, shared links, reading list
• iCloud Keychain
• iTunes Radio
• New Siri – Male / Female (even pulls from Bing!)
Developer Features (available now)
• Support for A7 and 64-bit
• OpenGL ES 3
• M7 and Core Motion
• New Metro-inspired User Interface
• New APIs for AirDrop, Scheduled Tasks,
camera, video capture, Map Kit (directions API,
3D, etc.)
• Game Dev: New SpriteKit framework, new
Game Center, support for game controllers
• iBeacon accessories & Bluetooth LE
• New Inter-App (shareable) Audio
Announced June 2013 at WWDC: developer.apple.com/wwdc/videos
36. What’s New in Xcode 5
• Automatic Configuration: enable Apple
services in your app, from within the IDE
• Test Navigator: helps you create, edit,
and run your unit tests (TDD)
• Bots for Continuous Integration
• Auto Layout: Create a single user
interface which automatically adjusts to
screen size, orientation, and localization
• Asset Management
• Debug Gauges: show app resource
consumption data at a glance, including
CPU, memory, energy use, iCloud, and
OpenGL ES
• Xcode Visual Debugger
• New Top-Level Source Control Menu
37. Summary and Next Steps…
Getting Started as an iOS Developer
Register for a free account at developer.apple.com
Get/buy a Mac and install Xcode for free from the Apple Mac Store
Learn More About iOS Development via Official Apple Videos
Official Getting Started Videos: developer.apple.com/videos/ios
WWDC Videos: developer.apple.com/wwdc/videos
Check Out Additional Learning Resources
Pluralsight iOS Training: www.pluralsight.com/training/Courses#ios
Twitter List of iOS Experts: twitter.com/ActiveNick/ios-dev-bloggers
Download Additional Resources & Become an Expert
Explore Free Open Source Controls: www.cocoacontrols.com
Leverage Azure Mobile Services in your Apps: http://bit.ly/mswams
Try the many developer toolbox products I covered, and more!
46
1
2
3
4
38. iOS Technical Resources
• Age of Mobility Blog
– www.AgeofMobility.com
• Official Getting Started Videos
– developer.apple.com/videos/ios
• WWDC Videos
– developer.apple.com/wwdc/videos
• Pluralsight iOS Training
– www.pluralsight.com/training/Courses#ios
• Subscribe to Dave Verwer’s iOS Dev Weekly Newsletter
– http://iosdevweekly.com
• Code by SteveZ
– www.infragistics.com/community/blogs/stevez
• Torrey’s Blog
– www.infragistics.com/community/blogs/torrey-betts
• Twitter List
– twitter.com/ActiveNick/ios-dev-bloggers
39. Recommended iOS Books
iOS Programming for .NET Developers
(Josh Smith)
http://iosfordotnetdevs.com
Programming iOS 7, 4th Edition
(Neuburg, O’Reilly)
http://amzn.to/1el9Z7L
iOS Programming: The Big Nerd Ranch Guide
4th Edition(Conway, Hillegass, Keur)
http://amzn.to/1dIM999
Objective-C Programming: The Big Nerd Ranch Guide
2nd Edition (Hillegass, Ward)
http://amzn.to/1kHJQaB
40. Free iBooks
These iBooks are not very recent, dating back
to 2010 and iOS version 4
But free is free!
Use them as a starting point but make sure to
stay current with references on programming
for iOS 5 and 6
Additional iOS Programming books are available for free from Apple via the iBooks Store on
your iOS device, including Objective C, Cocoa Fundamentals, iOS, OS X, Deployment &
more.
Available on iPad and iPhone
41. Thank You!
Slides will be posted on my Slideshare account.
Please fill out an evaluation. Your feedback is important and appreciated.
Slideshare: www.slideshare.net/ActiveNick
Blog: www.AgeofMobility.com
Twitter: @ActiveNick
Mobile Apps: www.bigbaldapps.com
LinkedIn: www.linkedin.com/in/activenick
Website: www.AgeofMobility.com
Email: nick.landry@microsoft.com
Editor's Notes
Simulator: Runs on desktop CPU, faster, more RAM, no camera APIs, no push notifications. However, it can simulate low-memory conditions, slow down animations, simulate multiple device types