iOS 9 Error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

With the release of iOS 9 this week, there’s some changes to the development of the application.

If you are writing an app now and it calls certain external api or webservices, you will hit the following error.

The resources could not be loaded because the App Transport Security policy requires the use of a secure connection.

There are 2 solutions to this, first make sure that the connection you are trying to make support https. Change that in your codes and build, if error persist.

The second solution is to add a new value to the Info.plist in your solution file.

Add a Key called NSAppTransportSecurity as a Dictionary

Add a sub-key called NSAllowsArbitraryLoads as Boolean
and set its value to YES.

Adding a side menu to your IOS App – RESideMenu Storyboard Tutorial Part 2

This is continuation from Part 1.

We have previously created the Storyboard, now we need to configure some settings.

RootViewController.h – Add the following codes

RootViewCodes

#import "RESideMenu.h"

@interface RootViewController : RESideMenu <RESideMenuDelegate

RootViewController.m – Add the following codes

- (void)awakeFromNib
{
    self.menuPreferredStatusBarStyle = UIStatusBarStyleLightContent;
    self.contentViewShadowColor = [UIColor blackColor];
    self.contentViewShadowOffset = CGSizeMake(0, 0);
    self.contentViewShadowOpacity = 0.6;
    self.contentViewShadowRadius = 12;
    self.contentViewShadowEnabled = YES;
    
    self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
    self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"left"];
    self.backgroundImage = [UIImage imageNamed:@"Stars"];
    self.delegate = self;
}

#pragma mark -
#pragma mark RESideMenu Delegate

- (void)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController
{
    NSLog(@"willShowMenuViewController: %@", NSStringFromClass([menuViewController class]));
}

- (void)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController
{
    NSLog(@"didShowMenuViewController: %@", NSStringFromClass([menuViewController class]));
}

- (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController
{
    NSLog(@"willHideMenuViewController: %@", NSStringFromClass([menuViewController class]));
}

- (void)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController
{
    NSLog(@"didHideMenuViewController: %@", NSStringFromClass([menuViewController class]));
}

Take note of the leftMenuViewController in the awakeFromNib method. We going to set those identifier to our storyboard’s viewcontroller.

Storyboard – RootViewController

Set the class to RootViewController.

SetClassforRootView

Storyboard – NavigationViewController

Set the StoryboardID to contentViewController.

 

SetNavigationControllerStoryboardID

 

Storyboard – HomeViewController

  1. Set both the Class and Storyboard ID.

SetClassandIDforHomeController

2. Now add a UIBarItem to your navigation.

BarButtonItem

3. Link the UIBarItem with the presentLeftMenuAction.

Linkthemup

 

Now you are good to test! Ping me up if you have issue.

Adding a side menu to your IOS App – RESideMenu Storyboard Tutorial – Part 1

In this tutorial, we are going to cover some of the quick and easy way of adding a side menu to your iOS app.

Basic Housekeeping

Firstly, let me introduce you to http://www.cocoacontrols.com, this is repository that provides a bunch of custom controls that are designed for iOS and Mac OSx. Sometimes we should not reinvent the wheel, but harness the power of the internet and community around.

Next, we are going use cocoa pods, if you are not sure what that is, head over to the following url -> Raywenderlich’s intro to cocoapod

So I have choose, RESideMenu, an amazing and beautiful control. GitHub – RESideMenu.

Getting Started – Adding RESideMenu to your project

  1. Adding the library into your project, if you have a pod file add the following:
    pod 'RESideMenu', '~> 4.0.7'
    
  2. Within your Terminal, browse to your XCode project location and type the following:
    pod install
  3. Xcode should generate a xcworkspace extension for you. Moving forward you should be only using this file.

Getting RESideMenu to work

Let create the following files in your project.

  1. RootViewController – Add New File -> Cocoa Touch Class
  2. HomeController – Add New File -> Cocoa Touch Class

The above should inherit UIViewController.

Next in your Main.Storyboard, add the following:

  1. UIViewController
    Searching for UIViewController
  2. UINavigationController

It should look like below after you are done.

Storyboard

In the next post, I am going to show you what we need to configure.

 

 

Xcode & Three20 Framework

This article will cover the basic of adding the Three20 framework to your Xcode 4 solutions.

A little background of this particular framework, quoting from the source.

Three20 is a open source Objective-C library used by dozens of well-known brands in the App Store, including Facebook, Posterous, Pulse, Meetup.com, and SCVNGR. Three20 provides powerful view controllers such as the Launcher, the popular Photo Browser, and internet-aware tables.

Another post will be written to discuss about the features of the framework, Three20. But for now let’s us get started on adding this the Three20 to your Xcode 4 project.

Three20 source code could be downloaded from the following link. www.three20.info

I do strongly suggest that you download the tar.gz version.

  1. Start by extracting the content of the file you downloaded from the site.Again, I suggest that you should extract the file on the desktop.
  2. Locate the file ttmodule.py at that paticularly path three20/src/script/

    xcode4 three20 facebook
    xcode4 three20 facebook

     

  3. Open Terminal,
    Enter: python
  4. Drag ttmodule.py into the terminal window,
    Enter: -p
  5. Locate your xcode project, Drag the .xcodeproj file into the Terminal.
    Enter: Three20
  6. Check that the Terminal Window should now look something like this
    > python /Users/xxx/Desktop/three20/src/scripts/ttmodule.py -p /TestingProject/TestingProject.xcodeproj Three20 
    Press Enter.

 This will add the Three20 framework into the xcode project and you can find out more on how to use the following at the following site.

Popovercontroller for Iphone

I was searching for a good community control for the popoverviewcontroller seen on the ipad.

I present to everyone, .

It was so simple to get started with the above and you can remove the complexity in the developing customize UI and get along with your actual development work.

Steps to get it working.

1. Add the following files

  • FPPopoverController.h
  • FPPopoverController.m
  • FPPopoverView.h
  • FPPopoverView.m
  • FPTouchView.h
  • FPTouchView.m
  • ARCMacros.h

2. Add the following codes in your IBAction event.

ViewController *content = [self.storyboard instantiateViewControllerWithIdentifier:@"home"];


FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:content];
popover.arrowDirection = FPPopoverNoArrow;


[popover presentPopoverFromPoint:CGPointMake(self.view.center.x, self.view.center.y - popover.contentSize.height/2)];

Lastly, do check out the demo included in the git checkout!

[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.’

[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.’

I finally got time to start working on some weekend IOS project and I am starting to get rusty with my IOS language.

Started one of my older project and tried to get going but hit an error i thought was pretty base.

Basically this error is associated with the UIPopoverController and you are running the simulator in iPhone mode and not in iPad mode.

Hope that helps anyone who face the same issue.

PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))

PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))

Getting the above mention error when building an IOS app.

Solution: Do a clean on your solution in Xcode and try to build again that should resolve the issue.

UIButton within UITableViewCell. (CheckBox)

Today I am going to discuss about adding a checkbox in the UITableView.

If you are not aware, Xcode provide you with a fair bit of controls out of the box but checkbox is missing!

This post will teach you, how to implement one the simple way.

Continue reading “UIButton within UITableViewCell. (CheckBox)”

Adding Storyboard in your project

So I have worked with Xcode’s Storyboard for awhile now, most of the work are done with a design template that have Storyboard already in.

Just the other night, I tried creating a Single View Application and try to implement a push via segue on it and was thrown with the following:

Error:

Terminating app due to uncaught exception ‘NSGenericException’, reason: ‘Push segues can only be used when the source controller is managed by an instance of UINavigationController.’

Bear in mind that with the various option available on Storyboard, modal will work fine but not push.

For push to work, you will need a UINavigationController. In doing so you can just drag a UINavigationController onto the Storyboard and make sure that you set it as the start of the application.

NavigationController with Start