April 2012 | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

How To Develop iPhone Apps on Windows (Develop iPhone apps on Windows with Mac )

Thursday

Create iPhone Apps On Windows:
                                        In this article I'm going to explain how to develop iphone apps on windows OS?, normally to create  a iphone app you will need an Intel-based Mac as the iPhone SDK requires OS X to run applications such as Xcode and the iPhone Simulator. Unfortunately, there is no legal way to develop applications for iPhone on anything that isn't a Mac.


                 If you want develop iPhone app on Windows? Either you buy a Mac book or one of the other alternate way is,  you can install Mac OS on windows by using VMware. Make sure your system must  support Virtualization (check it in your BIOS)

Follow the steps below  to create iPhone / iPad apps using MAC on Windows.

 Downloads:

You can download the following items from the web,
  •  VMWare Workstation 7 or later.
  •  Mac OS X Lion 10.7 
  •  XCode 4.1.1 or later.

 Install and run Mac os on windows:
 Install the VMWare workstation on windows.

  •  Run the batch file from the Mac OS folder.
  •  Enable the Intel Virtualization in BIOS.
  •  Run the Mac OS X Lion on VMWare.
  •  Share the Xcode file from Windows to Mac in VM Ware. (This folder is an interface between MAC and Windows)
  •  Install the Xcode on Mac.
  • Create your app

Sharing Files Between Windows and Your Mac - VMware:

                                                                       You can set up shared folders in guest operating systems to share files between your Mac and your Windows and other virtual machines. To use shared folders, you must configure your virtual machine settings to enable shared folders and to specify which directories on your Mac are to be shared.

The shared folders can be in your Mac file system or can be in your Windows or  they can be network directories accessible from your Mac.

 Refer the following image to create shard folder between Widows and Mac.



I'm installed Mac OS X Lion and created my app by this way.

Please share this knowledge to your friends, They may don't have MAC but they want to create iphone app.

 Before going to implementation you must know about


Solution: 'release' is unavailable: not available in automatic reference counting mode - iphone

Saturday

iphone: 'retain , release' is unavailable: not available in automatic reference counting mode:
                                                                              When I working with iphone memory leak related issues in iOS 4 and building projects in XCode 4.2.x,  I've encounter the build error like "'release' is unavailable: not available in automatic reference counting mode". And I got the following solution from the net.
                                                                           The default setting for iOS projects have a build setting named "Objective-C Automatic Reference Counting" set to 'Yes'. Simply set this to 'No' and the reference counting error will go away.(see the image bellow).




You have another one option...

Remove all retain release  autorelease NSAutoReleasePools and retainCount calls, since ARC makes them for you. With the exception of NSAutoReleasePools They have been replaced by @autorelease{}.

The second option has been automated by apple.

ASP.NET : how to get ip address using csharp(c#)

Thursday

How to get a client's ip address with ASP.NET :
                                         Internet protocol is a communication between the nodes. Internet protocol, which is used to track a system host and used address the location. If we need to identify the user who are all accessing our website and store the Internet protocol address in our database.

                                Fetch a client's Internet protocol address as soon as he access our web site in asp.net. Some of them may use a proxy Internet protocol address. But we can get their Internet protocol address with this simple code.


Code:
//Add the Namespace
using System.Net;
//Get Visitor IP address method
public string GetVisitorIpAddress()
{
string stringIpAddress;
stringIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (stringIpAddress == null) //may be the HTTP_X_FORWARDED_FOR is null
{
stringIpAddress = Request.ServerVariables["REMOTE_ADDR"];//we can use REMOTE_ADDR
}
return "Your ip is "+stringIpAddress;
}
//Get Lan Connected IP address method
public string GetLanIPAddress()
{
//Get the Host Name
string stringHostName = Dns.GetHostName();
//Get The Ip Host Entry
IPHostEntry ipHostEntries = Dns.GetHostEntry(stringHostName);
//Get The Ip Address From The Ip Host Entry Address List
IPAddress[] arrIpAddress = ipHostEntries.AddressList;
return arrIpAddress[arrIpAddress.Length - 1].ToString();
}
//Get The Visitor Ip Address
string strVisitorIpAddress = GetVisitorIpAddress();

//Get The Lan Ip Address
string strLanIpAddress = GetLanIPAddress();
Share this to your friends. Thanks!

iPhone: Xcode Shortcut keys

XCode Keyboard Shortcuts - iPhone:
                                     Using shortcut keys are much faster then using mouse.Here is some of the xcode shortcuts.

For Shifting
  • Alt-⌘-Up to alter between .m and .h file

  • ⌘-Shift-D, When you want to open a file or a symbol definition that's in your project or in a framework.

  • ⌘-Shift-E expand the editor view to full height of the window.

  • Alt-⌘-Left / Alt-⌘-Right, Navigate among open files back and forth.

  • Control-comma to show the list of available completions, Control-period to insert the most likely completion, and Control-Slash & Shift-Control-Slash to move between place holder tokens.

  • ⌘-double click on a symbol to see the definition of a symbol.

  • Option-double click on a symbol to see the documentation for that symbol– OR– Right click on any word and select 'Find Selected Text in API Reference' to search the API for that word.

  • Cmd-/ to automatically insert "//" for comments.

  • Ctrl+Left/Right Arrow to do intra-word text navigation.

  • Control-1 list down all the project files.

  • Control-2 to access the popup list of functions/methods/symbols in this file.

  • Control-3 list down all the include files

  • Right click on a variable in your function and click edit all in scope.

  • ⌘-[ and ⌘-] to indent and unindent selected text. Makes cleaning up source code much easier.

  • Control-Shift-R to show the Console

  • Control-Alt-⌘-R to clear the log

  • Control-⌘ Left/Right to fold and unfold the function.

  • Shift-⌘-C, the class browser in Xcode.

  • ⌘-=, Jump to the next error in the list of build errors. Display the multiple Find panel with ⌘-Shift-F.

  • ⌘-O, Jump to the Project tab, to the build tab with ⌘-Shift-B and to the debug tab with ⌘-Shift-Y.

iphone apps development requirements

Minimum requirements for iphone app development:

These are all the things you know before you start developing iPhone applications:

  •  You need a Intel based mac os x( Mac mini, Mac book, Mac pro, Mac OS Lion like this..) (or) I'm Installed Mac on windows using VMware

  •  To submit your work to apple you need a apple developer license as well.

  •  Xcode (free download)

  •  The SDK is free to download, so you can build you application and test it on simulator without any cost. But if you want to test it on your iPhone/iPod touch or submit it to apple store, you must have a developer license.

  •  To test your application, you must have either iPod or iPhone because Simulator and device behaves differently on some features like memory.  So I highly recommend you to buy one device as well.

  •  Programming language is Objective – C and its very similar to C/C++.

Download: iPhone voice recorder with Timer / Pause / Resume and Play actions

Tuesday

Recording Audio on an iPhone using AVAudioRecorder with Timer / Pause / Resume  and Play actions :
                The iOS AV Foundation framework provides the ability to record sound on the iPhone using the AVAudioRecorder class.

          The goal of this articale is to create an iOS 4 iPhone application that will record and playback audio. It will do so by creating an instance of the AVAudioRecorder class and configuring it with a file to contain the audio and a range of settings dictating the quality and format of the audio. Playback of the recorded audio file will be performed using the AVAudioPlayer class.

            Audio recording and playback will be controller by buttons in the user interface that are connected to action methods which, in turn, will make appropriate calls to the instance methods of the AVAudioRecorder and AVAudioPlayer objects respectively.


         In this iphone voice recorder project  you can Record / Pause / Resume and play the audio. In additionally I'm implemented timer for keep tracking the recording time  like iphone's voice memo. I'm using the currentTime property of AVAudioRecorder (audioRecorder.currentTime) to get the time, in seconds, since the beginning of the recording which I used to display on label (see the screen shot).

Download demo:

          You can download iphone voice recorder from here.

If this post was useful for you, please share this knowledge to your friends . Thanks..!


iphone - Resize UIImage without change aspect ratio

Monday

iPhone Resizing a UIImage:
  This is the sample code for resize an image without change it's original aspect ratio.

Copy and  paste the following code into your .h file

// Change image size without change image ratio
-(UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)newSize;



This is the method for resize the image, copy and  paste the following code into your .m file
-(UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)newSize { 
   
    float width = newSize.width;
    float height = newSize.height;
   
    UIGraphicsBeginImageContext(newSize);
    CGRect rect = CGRectMake(0, 0, width, height);
   
    float widthRatio = image.size.width / width;
    float heightRatio = image.size.height / height;
    float divisor = widthRatio > heightRatio ? widthRatio : heightRatio;
   
    width = image.size.width / divisor;
    height = image.size.height / divisor;
   
    rect.size.width  = width;
    rect.size.height = height;
   
    if(height < width)
        rect.origin.y = height / 3;
    [image drawInRect: rect];
   
    UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();  
   
    return smallImage;
   
}

And finally this is the method to call image resize function.

  UIImage *imageCC= [UIImage imageNamed:@"codingcluster.png"];      
  // Pass your image size as paramater
   UIImage *buttonBk = [self scaleImage:imageCC toSize:CGSizeMake(40.0,40.0)];

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets