iOS – Objective-C | Scale Image Size to Fullscreen


You may need to use the following imports (if needed, update your pod file accordingly)

#import <UIImageView+WebCache.h>
#import <UIView+CBFrameHelpers.h>

Using UIImageView

 // UIImageView * flyerImageView; define in .h file and connect to your imageview in .xib file
 UIImage *_image = [UIImage imageNamed:@"some_image_name.png"];
 [flyerImageView setImage:_image];
CGSize actualSize = image.size;
 float scale = flyerImageView.frame.size.width / (float)actualSize.width;
CGSize newSize = CGSizeApplyAffineTransform(actualSize, CGAffineTransformMakeScale(scale, scale));
         if (newSize.height > 290) {
             newSize.height = 290;
 float increment;
increment = newSize.height - flyerImageView.frame.size.height;
dispatch_async(dispatch_get_main_queue(), ^{
       [flyerImageView setSizeFromSize:newSize];

Using UIImage

UIImage *_image = [UIImage imageNamed:@”some_image_name.png”];
UIImage *big = [UIImage imageWithCGImage:_image.CGImage scale:0.1 orientation:_image.imageOrientation];

Un-able to download application “” could not be installed at this time.


Unable to Download Application

Unable to Download Application

Well, this is quiet annoying error faced by a lot of iPhone users when downloading application to their  phones. There could be several reasons why this error could arrive. That is why it’s not that easy to fix, specially, when you know don’t exactly know where to look and start debugging from.

Here are the few steps you can take to get rid of it.

  1. Clear your cache and cookies in Safari, make sure your device is in provisioning profile and provisioning profile is installed on the device. If everything mentioned above didn’t help, try to create a new build with higher build number and try to distribute your app again.
  2. Please check if your iOS certificate is still valid and Provisioning profile is still active. Renew / re-activate if needed.
  3. Check if the new devices iOS version. It should be equal or above the build iOS version.

NSInvalidUnarchiveOperationException due to NSLayoutConstraint


Controller crash with the following error?

Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’, reason: NSLayoutConstraint

One quick solution::

  1. Open the .xib file of that controller.
  2. click on the view and go to file inspector in the right pane.
  3. deselect auto layout.
  4. build and run the application.

Works like a charm. 🙂


NSUnknownKeyException’, reason: ‘[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.’


Okay so here is just another annoying error I faced during development. Here is the error log

NSUnknownKeyException', reason: '[<UILabel 0x17428340> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.'

Reason 1:

Wrong or expired reference of the View(s) to the IBOutlet with the file owner.

In interface builder you linked your IBOutlets from File's Owner when you should link them from parent view


I figured out that one of my views are linked to the file owner directly when it has to be linked to some other view (because it’s a subview). I removed the references and added all over again.

Basically I had a view structure like

1) Parent_View
1.1)- Sub_View
1.1.1)= ScrollView1
1.2)- ScrollView2

1.2 contained the Login form where as 1.1.1 has the profile view.

I was trying to switch between these 2 views depending on the user session availability. I accidently attached delegates of the 2 scrollviews with the file owner (which is wrong since I am hiding and un-hiding it from the parent_View). Not only that, I added some UILabels in to one of the scrollViews and gave a reference of the IBOutlets and then changed the names in the .h file (GOD! I know I make silly mistakes all the time).

I removed all the references and removed all the Views I added after last successful build. Then again I added the views with their references one after another.

Reason 2:

In identity Inspector, with in User Defined Runtime Attributes section, make sure you have given  the correct reference to the classes.

This was the main reason why this error arose for me. I immediately corrected the name (it’s case sensitive!) and Viola! and started working as it showed be.

This saved my day (err.. well .. not the whole day, actually it saved an hour before the day ended… 😀 )

Hope this helps you in one way or another. Would love to hear from you guys and how you solved this issue and don’t forget to rate and comment! it’ll be so kind of you if you do.. 🙂

Eclipse freezes while loading workspace



Quick Solution 1:
Just go to your workspace directory and delete “.meta” folder. Restart eclipse and it will create a new workspace. Import (all of) your project(s) again. Start working as you were!

Quick Solution 2:
Make a new user on your system. Try restarting eclipse and create a new workspace. Import/create you projects.