iDev : Orientation Notification

Way is :
/********************************* Notification For Orientation ***************************************/

#pragma mark – Orientation Notification
#pragma mark callNotification

 
-(void)changeOrientationsNotification{
    
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self
                                             selector: @selector(orientationWillChange:)
                                                 name: UIApplicationWillChangeStatusBarOrientationNotification
                                               object: nil];
}
 

#pragma mark – orientationWillChange

 
– (void)orientationWillChange: (NSNotification *) note
{
 
UIInterfaceOrientation orientation = [[[note userInfo] objectForKey: UIApplicationStatusBarOrientationUserInfoKey] integerValue];
 
    if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight){
[self shouldAutorotateToInterfaceOrientation:orientation];
//NSLog(@”Landscape”);
}else {
[self shouldAutorotateToInterfaceOrientation:orientation];
//NSLog(@”Portrait”);
}
}
/*********************************Orienation closed***************************************/
 

 
#pragma mark – Orientation Code For iOS6
/************** ORIENTATION CODE FOR IOS 6 START **************************/
 
-(BOOL)shouldAutorotate
{
    return YES;
}
 
-(NSUInteger)supportedInterfaceOrientations
{
    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
 
    if (orientation == UIInterfaceOrientationLandscapeLeft || orientation ==UIInterfaceOrientationLandscapeRight){
[self shouldAutorotateToInterfaceOrientation:orientation];
//NSLog(@”Landscape”);
}else {
[self shouldAutorotateToInterfaceOrientation:orientation];
//NSLog(@”Portrait”);
}
    
    return UIInterfaceOrientationMaskAll;
}
 
 
/************** ORIENTATION CODE FOR IOS 6 END **************************/
 
 
Calling Procedure :
     [self performSelector:@selector(changeOrientationsNotification)];

Keep Coding… 🙂

Advertisements

iDev: How to install GCC Compiler on Mac OS-X?

How to install GCC Compiler on Mac OS-X?

Problem Description:
Often times, you need c or gcc compiler to compile open source projects in Mac OS X. The problem is Mac OS X doesn’t install the gcc compiler by default.
If you try to install or compile some projects that required c/gcc compiler, following errors message will be logged :
1. configure: error: C compiler cannot create executables
2. configure: error: no acceptable C compiler found in $PATH

In terminal, type “gcc“, you will get message “command not found”.
$ gcc
-bash: gcc: command not found

Solution: First Way –>
To install gcc compiler on Mac OS X, you need to download and install “Command Line Tools for Xcode”, which is available in Apple’s developer page. See following steps :
1. Register Apple Developer Account : Go to Apple Developer Login page and register your account or login with our existing account details.
2. Command Line Tools for XCODE : In Apple developer page, “Developer Tools” category, find “Command Line Tools for Xcode“, choose your version and click on the xx.dmg file (file size is 100mb ++) to start the download.
3. Installation: After .dmg file is downloaded, a small dialog will be prompted and show you this file – “Command Line Tools.mpkg“, just double click on it, follow the wizard guide to complete the installation.
4. Verification: After installation is completed, run “gcc -v” in terminal again. If everything fine, following output will be displayed.
mkyong$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: {ignore long text…}
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

Done, the gcc version 4.2.1 is installed on Mac OS X successfully.

Solution: Second Way –>
1. Open XCODE 4.3 and above
2. Click Xcode–>Preferences
3. Click on Download Tab –> Component –> Check and Install Now
4. In list select Command Line Tools and Install.

Done …. Keep Coding 🙂

iDev: How to create .ipa file using Xcode ?

How to create .ipa file using Xcode ?

Here your answer:

First question is that which version of XCODE you are using,

Procedure for Xcode 4.3 and above : As of Xcode 4.3, there is no option of Share in organizer.

1.First of all,choose your device as IOS Device in Scheme near Breakpoint tab in Xcode.

2.In Xcode menu,Product->Clean and Product–>build your application.

3.If the provisioning certificate is not valid,it will lead to build failed with an error.If so you have to change it to a valid certificate through your project->build settings.Else if build succeeded just leave this step.

4.Then select Product->archive,it will create an archive file in Organiser->archives and open it up for you after archive finished.

5. Choose Distribute and then select the option for save as enterprise or adhoc application.

6. Saved it your .ipa file in your desktop.

if you are using XCODE  3 and above but less then xcode 4.3 then procedure are :

1.First of all,choose your device as IOS Device in Scheme near Breakpoint tab in Xcode.

2.In Xcode menu,Product->Clean and Product–>build your application.

3.If the provisioning certificate is not valid,it will lead to build failed with an error.If so you have to change it to a valid certificate through your project->build settings.Else if build succeeded just leave this step.

4.Then select Product->archive,it will create an archive file in Organiser->archives and open it up for you after archive finished.

5.choose share tab in Organizer followed by contents->.ipa and Identity->choose your valid distribution certificate and click next.

6.within a minute it will ask name for your IPA file to save.Give a name and save it in Desktop.

7.Open iTunes and drag and drop your IPA file in Library->Apps.

8.Now connect and select your Device in itunes->choose apps tab under it and sync your app ipa to the Device.It will install your IPA file to the device.

9.Thats all.

Another Way :

the easiest way but another option is to do the following.

  1. Add necessary profiles and adjust build settings.
  2. Set device as target to run the application.
  3. Build the product.
  4. Go to Products->yourAppName.app. Right click and show in finder.
  5. Drag & drop to itunes profile and binary file.
  6. Select app in iTunes and right click to show in Finder. And there you can get the .ipa file.

Now you can run your App IPA file in your device.

Keep Coding…..:)