Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

Thursday, August 26, 2010

Installing iPhone/iPad application ad-hoc

At my current job, I had to remotely install some beta versions of the iPad app for some clients, before the app was actually released on iTunes. There are several steps that one has to take in order to achieve that (assuming you have followed some of them that describe creating Certificates, App IDs, etc):
  1. In your iPhone Developer account, go to the iPhone Provisioning Portal, the to Devices, and add the iPad device to the Current Registered Devices section. You have to know the Device UDID (40 characters that can be copied form iTunes when you have the iPad plugged into your computer).
  2. Add the newly created device to the Distribution Provisioning Profile. 
  3. On you station, drag-and-drop the distributed provisioning profile into XCode. 
  4. Under XCode, change both your app's and your target's build properties to use the new distribution provisioning profile. 
  5. Delete the old Entitlements.plist file and create a new one.
  6. Change your settings so that XCode uses Device as the Active SDK, and Distribution as the Active Configuration. 
  7. Build your app, then zip the executable. 
  8. Export your private key and the developer identity certificate and import them into your client's Keychain (you might also need to export-import the AppleWWDRCA.cer file to your client). Finally, add the iPhone distribution certificate to the Keychain. 
  9. Download the new distributed provisioning profile and drag-and-drop it into your customer's iTunes app (either drop it on the iTunes icon, or in the App section). 
  10. Un-zip your application and drag-and-drop it into the app section of your customer iTunes (if the Apps section is not visible, go into iTunes -> Preferences and click on the checkbox marked as Apps). 
  11. Synchronize iTunes with the iPad to transfer the app from iTunes to your client's iPad. 
Hope it's going to help some of you. Enjoy!

Monday, April 12, 2010

Perfect Mobile Platform

What would make up the perfect mobile platform? What characteristics should it posses? Here are some of them, in no specific order:
  • User Interface/Experience - a rich user interface that provides a great user experience. When using the phone, everything should come naturally, with ease, and should have the WOW factor that makes you never want to leave the phone out of your hands. Doing common tasks should not take more than a few clicks. 
  • Application Ecosystem - Having many applications to chose from is not as important as having quality applications, those that satisfy a particular need, like finding a place to eat, checking your email, or playing Doom. Integrating location, social networking, and sensors is a must.
  • Internet Browsing - surf the Web from anywhere, on the go. A mobile browser should be able to render pages properly and fast, navigation should be done with ease, data should be compressed as to save bandwidth, and use the latest web technologies (HTML5, CSS, JavaScript, etc).
  • Battery Life - it better not leave me hanging after a full day of use, or in the middle of a call, or while searching for a place to eat using the GPS. 
  • Development Ecosystem - provide a rich set of APIs that can access all the features of the phone, and can provide the best user experience. Provide tools that can be used to make it easier to write apps. Publishing an application should not involve much hassle. 
  • Openness - here I refer to not only an open and free platform, but to a platform that allows any mobile technology to work on it.
  • Enterprise - features such as security, integration with email/calendar/notes/contacts servers, messaging, to name just a few. 
There is no one platform that satisfies all these needs better than any other platform. What is needed is a platform that has the user experience of iPhone and Android, the application ecosystem of iPhone (and Android very soon), the internet browsing of iPhone and Android (mostly any WebKit-based browsers), the battery life of the Blackberry, the development ecosystem of Android and iPhone, the openness of Android, and the enterprise characteristics of Blackberry. 

Will we ever have such a platform? I really doubt it. 

Thursday, April 8, 2010

Smartphone Application Downloads Forecast

ABI Research has recently published a forecast for smartphone application downloads world wide for 2009 - 2015, and which can bee seen in the chart below:


While iPhone apps are still going to be the leading source of downloads, for the year of 2010, Android is expected to have over 800 millions application downloaded, a major increase compared to 2009. Beside iPhone and Android, Blackberry and Symbian are also catching up on sales. What all this means, at least for me, is that it is a great time to be a mobile developer :)

Wednesday, March 3, 2010

Battery Information using iPhone's Cocoa Touch

I have done something similar (although on a smaller scale) to this but for the Android platform. For the iPhone platform, the main class used is UIDevice. Below is the header used:
#import <UIKit/UIKit.h>


@interface BatteryInformationViewController : UIViewController {
    IBOutlet UITextView *batteryLevel;
    IBOutlet UITextView *chargingState;
    // Used to format the battery level
    NSNumberFormatter *numberFormatter; 
}

@property (nonatomic, retain) UITextView *batteryLevel;
@property (nonatomic, retain) UITextView *chargingState;
@property (nonatomic, retain, readonly) NSNumberFormatter *numberFormatter;

@end 
There are two UI elements (text views), namely the battery level and the battery charging state. The corresponding implementation file is next:
#import "BatteryInformationViewController.h"

@interface BatteryInformationViewController ()

- (void)displayBatteryLevel;
- (void)displayBatteryStatus;

@end

@implementation BatteryInformationViewController

@synthesize batteryLevel, chargingState;


- (NSNumberFormatter *)numberFormatter
{
    if (numberFormatter == nil)
    {
        // Used for formatting the battery level
        numberFormatter = [[NSNumberFormatter alloc] init];
        [numberFormatter setNumberStyle:NSNumberFormatterPercentStyle];
        [numberFormatter setMaximumFractionDigits:1];
    }
    return numberFormatter;
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Register for battery level and state change notifications.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(batteryLevelDidChange:)
                                                 name:UIDeviceBatteryLevelDidChangeNotification object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(batteryStateDidChange:)
                                                 name:UIDeviceBatteryStateDidChangeNotification object:nil];
    
    [self displayBatteryLevel];
    
    [self displayBatteryStatus];
    
}

#pragma mark Battery Info

- (void)displayBatteryLevel {
    float batteryLevelLocal = [UIDevice currentDevice].batteryLevel;
    if (batteryLevelLocal < 0.0)
    {
        // -1.0 means battery state is UIDeviceBatteryStateUnknown
        self.batteryLevel.text = NSLocalizedString(@"Unknown", @"");
    }
    else {
        NSNumber *levelObj = [NSNumber numberWithFloat:batteryLevelLocal];
        
        // Using the numberFormatter property lazily creates that object the
        // first time it's used. 
        self.batteryLevel.text = [self.numberFormatter stringFromNumber:levelObj];
    }    
}

- (void)displayBatteryStatus {
    // Get battery state
    switch ([UIDevice currentDevice].batteryState) {
        case UIDeviceBatteryStateUnknown:
        {
            self.chargingState.text = NSLocalizedString(@"Unknown", @"");
            break;
        }
        case UIDeviceBatteryStateUnplugged:
        {
            self.chargingState.text = NSLocalizedString(@"Unplugged", @"");
            break;
        }
        case UIDeviceBatteryStateCharging:
        {
            self.chargingState.text = NSLocalizedString(@"Charging", @"");
            break;
        }
        case UIDeviceBatteryStateFull:
        {
            self.chargingState.text = NSLocalizedString(@"Full", @"");
            break;
        }
    }    
}

#pragma mark Battery Notifications

// Called when the battery level has changed
- (void)batteryLevelDidChange:(NSNotification *)notification
{
    [self displayBatteryLevel];
}

// Clalled when the battery status has changed
- (void)batteryStateDidChange:(NSNotification *)notification
{
    [self displayBatteryStatus];
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.batteryLevel = nil;
    self.chargingState = nil;
}

- (void)viewDidDisappear:(BOOL)animated {
    [[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"WhichView"];
}


- (void)dealloc {
    [batteryLevel release];
    [chargingState release];
    [numberFormatter release];
    [super dealloc];
}


@end 
The above code is commented, so it should be pretty obvious what it does. I first register for change notifications for battery level and battery status change, and display the initial values for those properties.

There is a really good example from Apple called BatteryStatus. It should give you anything you need regarding battery information.

I hope you find it useful!

Tuesday, January 12, 2010

Are students prepared for working in the industry?

This should have actually been a two-part blog, first talk about the fact that there are now course on iPhone and Android programming offered at my university, and second transition to the topic mentioned in the title of the blog, namely the existing gap between what we are thought in school, and what is actually needed outside in the industry. Just by the fact that such courses are being offered, I believe that the gap is getting a little smaller. Read on to get a feel of what I think about all this.

I had my first lecture as part of the iPhone Programming class offered at FAU (similar to the course offered at Stanford and available online for free) I am excited because mobile development has been a passion of mine for some time now. I have been working with J2ME since my fourth year of college (2004), and with Android since before its official 1.0 release. Both platforms come with their advantages and shortcomings. Now, the opportunity to take part of the iPhone class could not be left unanswered, hence I enrolled for the Spring semester as part of my last class moving toward the end of my PhD.

I wanted to look into iPhone programming for some time now, but there were some impediments like not owning a Mac, and not having time for it. Well, my first problem was solved because, graciously enough, our CEECS department at FAU has created an advanced Apple Lab that comes with 10 Macs and 5 iPod Touch. My second problem got solved due to the fact that I had to take one more class, so why not make it one that is all about mobile programming. At the end of the class, I could better compare and contrast the different mobile platforms that I am familiar with.

I had some (minor) complaints about the curricula here at FAU. I felt that the courses being thought are somewhat out of touch with the need of the industry. And because most of the students end up working in the industry, better choices for courses could be offered. I have a whole list of classes that I wish would be offered here, and I am going to share this with list with you (letting me know what other classes you think would be useful):
  • Web Services (SOA more generally)
  • Software Testing (Black/White Box, Integration/Regression/Acceptance/Unit Testing, TDD)
  • Java and C# (and here maybe more on the Enterprise side with Java EE and .NET)
  • Compilers
  • Project Management (Lean, Agile (XP, Scrum), RUP, V-MODEL)
  • Functional and Logical Programming
  • Distributed Systems
  • Math for Computer Science
  • Web Developemnt (in terms of Rails, PhP, Flash, Perl, Python, GWT)
  • Software Security (Encryption, SSL/TSL, HTTPS, Cyphers, Hashes, etc)
Mobile Development class that would include Java ME, Android, and iPhone Programming, was also on the list but fortunately enough, Android and iPhone Programming are currently being taught here at FAU (I am much involved in the Android class, not as a student, but as a teaching assistant). Refactoring was also on the list, but having a whole class on this topic seems a little too much (instead it could be incorporated in any programming class available).

I recently read an article written by Bjarne Stroustrup entitled "What Should We Teach New Software Developers? Why", that expressed some of the feelings I have on this topic. Although there is still room for improvement, I do believe that we (FAU, but I am sure some universities were already on this path for some time) are going in the right direction offering courses that are useful when graduating from school.

Thursday, March 19, 2009

Android 1.1 and iPhone 3.0

If you want a feature-by-feature comparison of Android and iPhone, read the Android Versus iPhone 3.0 article by lifehacker. Do remember that Android is only in its 1.1 release, while iPhone has seen its 3.0 version. Even though iPhone has more available features, let us not forget that Android is open source.