Posts Tagged iPhone

Restoring a lost iTunes Library

There's loads of information on the interweb about what to do when you accidentally delete all of your music from your computer, or wipe all the data from your iPhone. What there isn't is much discussion about what to do when you accidentally blitz your iTunes library but have all the music still in place. I managed this by inadvertantly moving all of my music to the Trash. I subsequently realised and moved it all back to where it originally lived, but on opening iTunes I found that my library had been burned and there was no music left, nor iPhone apps. This worried me slightly, and so this post briefly runs through how I resolved the issue.

  • Firstly, I moved all of the music files and folders back to exactly where they were originally located. This didn't fix my problem, but I left things as they were originally, just to be on the safe side – if you mess about with the folder structure then all bets are off.
  • I then opened iTunes and followed the instructions in Apple Support Article HT1451, "How to re-create your iTunes Library and Playlists". To do this, you'll need a copy of your iTunes library from prior to the point where you screwed it up. You do keep backups, right?
  • Import the old library as described in the support article, and your music and playlists will magically re-appear as though nothing bad had ever happened.
  • The above process also restored my podcasts, but if you're having trouble getting those back then you may want to check out Apple Support Article HT2562, "Podcasts playlist in iTunes is empty".
  • To get your iPhone apps back, you have a couple of options. You could connect your iPhone, then right-click it in iTunes and select "Transfer Purchases". This will copy all apps from the iPhone onto your computer. This obviously won't include any apps which you don't currently sync to the iPhone. You could also try using the "Check for Available Downloads" option in the "Store" menu of iTunes. However, a much better alternative presents itself…
  • You'll need to use a backup copy of your "Mobile Applications" folder, which is found in the "iTunes" folder (usually in /Users/<username>/Music on a Mac). Copy this to your Desktop. Click the "Apps" menu item in iTunes, and drag the contents of the "Mobile Applications" backup folder from your Desktop directly onto the iTunes window. This will copy all of the apps from the backup into your current iTunes library.
  • Now that the apps officially exist again according to iTunes, you might think you're in the clear. But you're not. If you sync the apps now, the 'new' versions from iTunes will overwrite the 'older' versions on your iPhone, wiping all your app data in the process (or so iTunes says when you try and do it!). So that's your [Angry Birds best score / VNC connection details] (delete as appropriate) gone forever.
  • The good news is that you keep regular backups of your iPhone (if not, you really should), so you can just restore from your last good backup, and everything will be hunky-dory. All I did here was right-click on the iPhone in iTunes and select "Restore from Backup". Note that Apple Support Article HT1766 suggests that if you just click the big "Restore" button, the iPhone will be restored to factory settings, not to your backup state, so beware! When you start the restoration, iTunes kindly informs you that only Contacts, Calendars, Notes, Messages and Settings will be restored, and then gets on with the job in hand. In theory, you should then be back to square one and able to carry on with your life as normal.
  • In my case, this didn't happen – when I tried to restore from the backup, I received an error message. My solution was therefore to click the "Restore" button (the one I warned you about above!), and restore to factory settings. Before it does this, iTunes asks whether you want to create a backup first – I said Yes. You can then do a full backup and when you first sync the newly-restored phone it'll ask whether you want to restore from a backup. Choose the one you created a few minutes earlier, and you should finally be sorted.  You'll need to set up your sync preferences in iTunes again (i.e. which apps, music, podcasts, etc. you want to sync), but, other than this, everything then worked absolutely fine for me.

Tags: , , , , , , ,

Objective-C / iPhone – Apple docs

Over the past few days I've started working with Objective-C, coding for the iPhone. I've not used Obj-C before, or indeed C/C++, so I really am starting from scratch both with the language and the platform. Going through the bookmarks I've amassed over the last 72 hours, most of them are from the Apple site. As the major backer of Objective-C globally, they have lots of documentation relating to the language. You'll need to register for an ADC account, which is free, and there's then a wealth of information available to you. I don't normally dig straight into documentation, preferring to work with online tutorials, but in this case I found the Apple reference docs to be by far the clearest. Their tutorials also explain why you're doing things, whereas a lot of others tell you what to type but don't give any justification for doing it. So below, is a list of

While Apple have loads of good documentation available, trying to wade through it all on their site is a bit of a nightmare (even just the iPhone reference library is huge), so I've compiled a list of what I found the most useful documents for a first-time Objective-C / iPhone developer. The descriptions are all Apple's too.

Objective-C

  • Objective-C Tutorial
    This document introduces the Cocoa application environment using the Objective-C language and teaches you how to use the Xcode Tools development suite to build robust, object-oriented applications.
  • Objective-C
    This document both introduces the object-oriented model that Objective-C is based upon and fully documents the language.

iPhone

  • iPhone Development Guide
    This document describes the iPhone application development process. It also provides information about becoming a member of the iPhone Developer Program, which is required to run applications on devices for testing.
  • Your First iPhone Application
    This tutorial shows how to create a simple iPhone application. It is not intended to give complete coverage of all the features available, but rather to introduce some of the technologies and give you a grounding in the fundamentals of the development process.
  • Foundation Framework Reference
    The Foundation framework defines a base layer of Objective-C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective-C language.
  • UIKit Framework Reference
    The UIKit framework provides the classes needed to construct and manage an application’s user interface for iPhone and iPod touch. It provides an application object, event handling, drawing model, windows, views, and controls specifically designed for a touch screen interface.
  • iPhone Human Interface Guidelines
    Read this document to learn about the range of application types you can develop for iPhone OS and the human interface design principles that inform all great software. In this document you also learn how to follow those principles as you design a superlative user interface and user experience for your software.
  • Featured Sample Code
    – Use the code and design from these samples to inspire your own development. This is a list of featured sample code. A complete list is available in the iPhone Reference Library.
  • All Sample Code
    – All the available code samples, not just the featured ones.

Programming Tools

  • iPhone OS Developer Tools
    Xcode is Apple’s suite of development tools that provide support for project management, code editing, building executables, source-level debugging, source-code repository management, performance tuning, and much more. Xcode is not the only tool you use though, and the following sections provide an introduction to the key applications you use to develop software for iPhone OS.
  • Interface Builder User Guide
    Interface Builder is a visual design tool you use to create the user interfaces of your iPhone OS and Mac OS X applications. Using the graphical environment of Interface Builder, you assemble windows, views, controls, menus, and other elements from a library of configurable objects.

Tags: , , , ,