Book Image

iOS Development with Xamarin Cookbook

By : Dimitrios Tavlikos (USD)
Book Image

iOS Development with Xamarin Cookbook

By: Dimitrios Tavlikos (USD)

Overview of this book

Table of Contents (22 chapters)
iOS Development with Xamarin Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing prerequisites


This section gives you information on how to download and install the necessary tools to develop with Xamarin.iOS.

Getting ready

We need to download all the necessary components on our computer. The first thing to do is register as an Apple developer on http://developer.apple.com. The registration is free and easy, and it provides access to all the necessary development resources. After the registration is confirmed through e-mail, we can login and download the iOS SDK from the address https://developer.apple.com/devcenter/ios/index.action#downloads. At the time of writing, Xcode's latest version is 5.0.1 and iOS SDK's latest version is 7.0.3.

How to do it...

To prepare our computer for iOS development, we need to download and install the necessary components in the following order:

  • Xcode and iOS SDK: A login to the Mac App Store is required. You can either search for Xcode in the App Store or click on the Download Xcode button in the iOS developer portal's download section. After the download is complete, follow the onscreen instructions to install Xcode. The following screenshot shows Xcode in the Mac App Store:

  • Xamarin Starter Edition: Download and run the Xamarin Starter Edition from Xamarin's website http://xamarin.com/download. Follow the onscreen instructions to install Xamarin Studio and Xamarin.iOS.

    Note

    The Xamarin Starter Edition is free, but there are some restrictions, such as a limit on the maximum app bundle size and no Visual Studio support. It does support, however, deploying to a device and to the App Store. At the time of writing, all recipes shown in this book are fully supported by the Starter Edition, except for the Using WCF services recipe in Chapter 6, Web Services. A Business or Enterprise Edition is needed for WCF support.

How it works...

Now that we have everything ready, let's see what each component is needed for.

Xcode

Xcode is Apple's IDE for developing applications for both iOS and Mac platforms. It is targeted on the Objective-C programming language, which is the main language to program in with the iOS SDK. Since Xamarin.iOS is an SDK for the C# language, one might ask what we would need it for. Apart from providing various tools for debugging iOS apps, Xcode provides us with the Organizer window. Shown in the following screenshot, we can use it to view a device's console logs, install and manage the necessary provisioning profiles, and even view the device's crash logs. To open the Organizer window, navigate to Window | Organizer on the menu bar, or press Cmd + Shift + 2 on the keyboard.

Interface Builder

The second component is Interface Builder. This is the user interface designer, which was formerly a standalone application. Starting with Xcode 4.0, it is integrated into the IDE. Interface Builder provides all the necessary functionality to construct an application user interface. It is also quite different from what .NET developers are accustomed to.

iOS Simulator

The third component is iOS Simulator. It is exactly what its name suggests: a device simulator that we can use to run our apps on, without the need for an actual device. The most important thing about iOS Simulator is that it has the option of simulating older iOS versions (if they are installed on the computer), both iPhone and iPad interfaces and device orientations. However, the simulator lacks some device features that are dependent on hardware such as the compass or accelerometer. Applications using these features must be tested and debugged on an actual device.

Xamarin.iOS is the SDK that allows .NET developers to develop apps for iOS, using the C# programming language. All APIs available to Objective-C developers are also available to C# developers through Xamarin.iOS. It is not a standalone framework with its own APIs for, say, user interfaces. A Xamarin.iOS programmer can use the same UI elements as an Objective-C programmer, along with the added benefits of C# such as generics, LINQ, and asynchronous programming with async/await.

There's more...

Applications developed with Xamarin.iOS have the same chances of making it to the App Store as all other applications developed with the native Objective-C programming language. This means that if an app does not conform to Apple's strict policy about app acceptance, it will fail, whether is written in Objective-C or C#. The Xamarin.iOS team has done a great job in creating an SDK that leaves the developer to worry only about the design and best practice of the code, and nothing else.

Useful links

The following are useful links that you can go through:

Updates

Xamarin Studio has a feature for checking available updates. Whenever a program starts, it checks for updates of Xamarin.iOS. It can be turned off, but this is not suggested since it helps with staying up to date with the latest versions. It can be found under Xamarin Studio | Check for Updates.

See also

  • The Compiling an iOS project and Debugging our application recipes

  • The Preparing our app for the App Store recipe in Chapter 14, Deploying