Search
Goodies

Social Networks
Designs I Like

Entries in iOS4 (13)

Saturday
Oct222011

Xcode 4.2, iOS versions and ARMv6, ARMv7 build architectures

Today I want to share my discoveries about compiling an iOS app under Xcode 4.2. With every major release of Xcode and iOS SDKs comes a few surprises. With Xcode 4.2 and iOS 5 SDK, the problem is that under Xcode 4.2, the new default build architecture is ARMv7 only. The ARMv6 is no longer part of the default settings. So, this may be a problem is your application needs to run on older devices. In my case, a few build and linking errors prevented a successful build of my app.


But, which device is using ARMv6 and which one is using ARMv7 ? Here is a list.
  • ARMv6 is for original iPod, iPod touch second gen, original iPhone and iPhone 3G.
  • ARMv7 is for iPhone 3GS and up, original iPad and up. 
Also good to know, the original iPod supports only iOS 3.1.3. The iPhone 3G is capable of running up to iOS 4.2. So, plan accordingly. See this table for maximum supported iOS versions for each iOS device: http://en.wikipedia.org/wiki/List_of_iOS_devices

If you want to re-add the ARMv6 architecture to your build settings, follow these instructions: Warning iPhone apps should include an armv6 architecture even with build config set?

For example, if you want to support iOS 4.2 and still support iPod touch second generation or the iPhone 3G, you'll have to set architecture to ARMv6 and deployment target to 4.2. The original iPhone, the original iPod touch won't be supported. You should also set the UIRequiredDeviceCapabilities in the info.plist of your app.

Update: thanks for pointing me that iPod touch second gen was missing and about the wrong link to the article on StackOverflow.

Friday
Jan282011

Disabled UISwitch in iOS 4.2 - weird visual artefact

Did you notice how weird a disabled UISwitch in iOS 4.2 simulator (and on a real device too) looks?

It seems as if the whitening overlay doesn't cover up all the base frame of the UISwitch. Ugly.

Thursday
Jan202011

Side effect of adding Retina Display artworks

I never pay attention to the size increase of an iOS app that adds Retina Display support. Well, I checked on Ultimate Password Manager. Here is a comparison from version 2.3.0 and 3.0.0 (upcoming).

Wednesday
Oct062010

UITabbar: a really weird display bug....

OK, this one is really really weird... This is a bug that I get when compiling and running Ultimate Password Manager inside the simulator these days... same thing happens on a physical device. As you can see on the following picture, all the Tabbar icons are on the same row and the screen is white.

The display bug goes away as soon as I tap on the screen in the white portion followed by a tap on one of the many tabbar icons. This problem is happening since a long time and I cannot figure out why. Could this be related to my UITabbar icon order restore method?

-(void)restoreTabbarOrder
{
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

     // Restore the tab-order from prefs
     NSArray *classNames = [defaults arrayForKey:kTabBarOrderPrefKey];
     if (classNames.count > 0)
          {
          NSMutableArray *controllers = [[NSMutableArray alloc] init];
          for (NSString *className in classNames)
               {
               for (UIViewController* controller in self.rootController.viewControllers)
                    {
                    NSString* controllerClassName = nil;
                    if ([controller isKindOfClass:[UINavigationController class]])
                         controllerClassName = NSStringFromClass([[(UINavigationController*)controller topViewController] class]);
                    else
                         controllerClassName = NSStringFromClass([controller class]);
                         if ([className isEqualToString:controllerClassName])
                         {
                              [controllers addObject:controller];
                              break;
                         }
          }
      }
     if (controllers.count == self.rootController.viewControllers.count)
          self.rootController.viewControllers = controllers;
               [controllers release];
     }
}


To the experts: HELP!!!

Wednesday
Oct062010

Using others artworks - bad idea?

I've been using extensively artworks from different sources for Ultimate Password Manager. Tabbar icons, in-cell left-side icons we're mostly taken from free resources on the web:

  • www.glyphish.com: very well done tabbar icons. Free. Many App Store application are using one or many of these icons. 
  • www.app-bits.com: nice icons too. This web site is so gorgeous. So are the icons. 
Problem is, what to do when we want to have Retina Display versions of these icons? We are pretty much in a bad situation as the authors may not have a version updated for higher resolution display. I know about glyphish.com which create a lot of new icons but for old one, they are not all Retina Display ready. This leaves me the task of rebuilding myself all my icons. This is not cool because, I'm not a graphic designer. 

Friday
Oct012010

More notes about iOS Background State Transitions

Here are some more notes about my implementation of background state transitions. 


application:DidFinishLaunchingWithOptions: What is not clear is: what should this method return as value: True or False. Many examples on the web are just return YES. Why?

Also, you cannot have both methods: applicationDidFinishLaunching and application:DidFinishLaunchingWithOptions:. In that case, the latter is ignored.

Many of those methods were already there in previous versions of iOS 4.0! The only new one in UIApplication delegate are:

didReceiveLocalNotification
applicationDidEnterBackground
applicationProtectedDataDidBecomeAvailable
applicationProtectedDataWillBecomeUnavailable
applicationWillEnterForeground


So we see that this is all about supporting background state transitions.

Regarding the implementation of NSCurrentLocaleDidChangeNotification notification, I've found that on the simulator, having my application run, then switch to the Settings.app in order to set the iPhone local to something else, then returning to my app, the application is re-launched. So, there is no need to implement UI reloading following this as the application is completely reloaded in the corresponding locale.

On NSUserDefaultsDidChangeNotification, I need to use NSNotification in order for the application to get notified when a value is changing while in the background. The thing is for Ultimate Password Manager, all the application preferences are read just in time each time I need to base some decisions so there is not need to adjust following a return to foreground. Three exceptions to this :
  • Show password in safe
  • Show tips
  • Show detailed view
For example, if the user put the application in background, change the settings in order to hide passwords then return to the application, the new setting will only be considered for new password safe entries while scrolling in the UITableView. This is not nice! Another example with Show detailed view: if the current view is "summary", then the user switch to the Settings.app, change to "detailed view" then return to the application, the password safe entries would need to be redrawn... the problem: how to we get a notification in the currently shown view controller? Add an NSNotification? Something like this?

    // listen for changes to our preferences when the Settings app does so,
    // when we are resumed from the backround, this will give us a chance to update our UI
    //
    [[NSNotificationCenter defaultCenter] addObserver:self
                                       selector:@selector(defaultsChanged:)
                                           name:NSUserDefaultsDidChangeNotification
                                         object:nil];
I'll write an update when I find the answer. 

One can read this interesting blog post for more information: http://www.mlsite.net/blog/?p=1989

Tuesday
Sep282010

Supporting iOS Background State Transitions

My work on Ultimate Password Manager version 3.0 has started. The first thing that I'm looking into is Fast Application switch and multitasking. In order for an iOS 4.0 based application to support Fast application switching, there is a few things that needs to be implemented or modified in Ultimate Password Manager code.

Many new application delegate methods needs to be in place:

  • application:DidFinishLaunchingWithOptions: this is the first application delegate method called at launch time. Make it lightweight. This new delegate method replace applicationDidFinishLaunching method. 
  • applicationDidBecomeActive: this method is called when the application enters the foreground state. This could be the result of the application being started (after the application:DidFinishLaunchingWithOptions call) or coming from the background state. This methods needs to be implemented too as it is part of the application startup sequence (called after applicationDidFinishLaunchingWithOptions: method). This is where the data structures loading and initialization will take place.
  • applicationWillResignActive: for Ultimate Password Manager, this method doesn't need to implement this at the next step is to be put in background, this is where we will do the work of saving the application state. BUT, since this method is called when an external event occurs (like SMS messages is received), if the user doesn't answer the incoming event, applicationDidBecomeActive: will be called but the application context being already live, we don't need in this case to reload it. I will have to implement a flag for that. 
  • applicationDidEnterBackground: replace entirely applicationWillTerminate method. Five (5) seconds is the time available to save application state.  Most of the code here will come from applicationWillTerminate:. 
  • applicationWillEnterForeground: this is a transition state and the next step is a call to applicationDidBecomeActive. I don't need to do much there.
Things that stay the same:
  • applicationWillTerminate: this method should stay implemented but most of the content must be put in applicationDidEnterBackground. Even under iOS4-based app that don't run on iOS 3.x, this method can be called by the operating system when the application is in background and needs to terminate the app. I think this doesn't apply for my app as no background task will be executing while in background (there is no long lasting task in Ultimate Password Manager). I may need to test that or ask the expert in forums. 
Interesting things to take care of:
  • Cleaning up resources for active alerts when going in background: what do we have to do in code to take care of presented UIActionSheet or UIAlert before going to the backup.
  • Removing sensitive information from the screen when method applicationDidEnterBackground because a screenshot is taken by iOS in order to present it back when the application returns to the foreground. In Ultimate Password Manager case, this includes removing any passwords that could be shown in a password safe entry... 
  • While the application is in background, UIApplicationExitsOnSuspend needs to be handled. 
  • Also while the application is in background, NSUserDefaultsDidChangeNotification needs some processing in order to adjust the UI for the new locale.
  • The application can be (and will be launched) after a local notification is received.  UIApplicationLaunchOptionsLocalNotificationKey should be handled.
  • I also need to remove the UIApplicationExitsOnSuspend key from the info.plist that was there in order to prevent my application to be put in background as it wasn't ready to support the new delegate methods in iOS 4.
This analysis has been conducted by following this chart and reading the Apple documentation.

Sunday
Sep262010

Starting to tackle iOS 4.0

Today, I'm starting to work on the next release of Ultimate Password Manager - version 3.0. To that end, I must concentrate on understanding the new features of iOS 4.0 that will be used by this release. Here is what part of iOS 4 unique features will be used:

  • Fast application switching
  • Local push notifications
  • In-memory encryption
  • Regular-expressions evaluation
  • Updated graphic elements for retina displays
I don't want to mess around by developing mechanisms that detect multiple iOS releases. I want to make version 3.0 an iOS 4.0 "required" application. As my user analytics from Flurry tells me, a big majority of my users are already on iOS 4.0.

Of course many other things will be part of this next release. But, I first need to look closely at iOS 4.0. To that end, I'm going to get a very detailed look at a very useful graphic made and published by a well know iOS developer name "Dr Touch". You can have a look at its web site here: http://www.drobnik.com/touch/. With his permission, here is the  UIApplication Delegate Messaging with Multitasking. 

Stay tuned for the implementation details of this chart on Ultimate Password Manager. 

Thursday
Aug122010

A few noteworthy articles

I've been reading a lot on the web since I'm back from vacations and I found out a few interesting articles.

Data Encryption on iOS devices
iOS 4 as a few improvements for data encryption but back to iOS 3 on iPhone 3GS, encryption was also available. Read more from this Nick Narris' blog post: Core Data and Enterprise iPhone Applications – Protecting Your Data. Blog post extract: "In iOS4, Apple introduced data protection. It gives you the ability to encrypt the hardware keys used to encrypt your files and to erase those keys when the system is locked – leaving your file unreadable until the phone is unlocked and the keys are regenerated." - Cool. I did not know that.

In version 3.0 of Ultimate Password Manager, I will replace my current encryption libraries in order to use the services provided by iOS 4.

Also, if you are looking for a very simple way to scramble an NSString, have a look at Obfuscate / Encrypt a String (NSString) from [iPhone developer:tips];. A very good and simple article. Please note that this is not real data encryption.

Local Push Notifications
Finally, the best for the last, a very nice tutorial from iCodeBlog about using Local Push Notifications introduced in iOS4. This particular feature will also be part on version 3.0 on my password manager application for the iPhone.

Have a nice reading!

Friday
Jul162010

The iPhone4 debacle (Update #4) - after the conference


People, calm down, this is a phone. Yes we expect to have it work perfectly but nothing is perfect, neither the iPhone nor Apple. But tomorrow there is a press conference called by Apple to address the iPhone 4 "issues". What we should reasonably expect from this media event?

First having iOS 4.0.1 out in the hands of the users to address the reception issues would help. Rumors are pointing to a release today! iOS 4.0.1 is out! This would at least send a message to the world: Apple do care about its users and they try to fix some of the issues.

Second, the Apple press conference with Steve Jobs in command needs to address these points:

  • tell how great the iPhone 4 is and put a few quotes to emphasize;
  • add a few quotes from people who don't have any issues with their device;
  • but some users are having issues and it is time to explain them;
  • what are the issues, categorize them. Bring some people in to help if needed;
  • how widespread the issues are;
  • recognize the problem and say "we made a few mistakes";
  • expose the corrective actions at the hardware level;
  • expose the corrective actions at the software level;
  • expose the corrective actions required to fix the device already in the hand of thousands of customers.
I think Apple did tweak the iPhone 4 hardware design by applying coating on the antennas a few weeks ago. I don't expect Apple to do a full recall but I expect they will offer 45 days to customers to return their iPhone IF they can demonstrate they are affected by the recognized issues. They will probably also offer free bumpers to those who ask for them as a small compensation or offer an in-store credit on their next purchase. 

All in all I'm sure Apple wants to show that they are responsive but as with many of their things, they respond when they are ready to do so. And I like it this way. This is not another Toyota story even if a few says it is. We'll all see tomorrow. One thing is for sure, Apple surely wants to put this fiasco behind them and move forward with the next great products that are awaiting in the labs and factories.

Update #1: Seems that Techcrunch are saying something quite similar to me.. iOS 4.0.1 is out too!
Update #2: CNN Tech as a good article too that falls in the same approach. Also, on my 3GS on 4.0.1, my bars are always fewer and I feel the situation is worse than before. But, according to this article from Anandtech, this is not the case.
Update #3: I also like this point of view.
Update #4:

  • They kind of reiterate the iPhone 4 is one of the best product they made
  • Sales did not slow
  • The YouTube video about the Antenna song was unexpected
  • They tried to explain what they know so far
  • Apple iPhone devices are not different than others phone makers - everybody faces challenges when dealing with cellular networks
  • The issue is not widespread and is overblown by a few haters that like to hate... 
  • They offer refund (they always did support that)
  • They offer free bumpers until september 30
  • They care about their customers
  • No really hardware fix (really?)
  • Upcoming fix for sensor issues (and they will probably inject a dose of tuning also regarding antennas signals changing conditions)
That is it. You don't agree with Apple? Go to an Apple store and ask for a refund then stop whining. Thank you.