Showing posts with label ios. Show all posts
Showing posts with label ios. Show all posts

Wednesday, April 6, 2016

How to set Android Home environment variables to your MAC OSx

How to set Android Home environment variables to your MAC OSx

When you try to create project using terminal from your MAC BOOK (MAC OSx), you end up getting an error saying:

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

To resolve this error, you need to set the ANDROID HOME environment variable. 
  • Make sure you install the android SDK installed in your MAC.
  • Navigate to the installed location of android SDK and copy the path.
    • EX: /Users/Madhavan/Library/Android/sdk
  • Open the terminal and export ANDROID HOME variable.
    • export ANDROID_HOME=/Users/Madhavan/Library/Android/sdk
  • Set the path variable to ANDROID_HOME.
    • export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Open terminal and write your command like below:

Madhavan-Subramanian-MacBook-Pro: Madhavan$
export ANDROID_HOME=/Users/Madhavan/Library/Android/sdk

Madhavan-Subramanian-MacBook-Pro: Madhavan$

export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


Tuesday, July 7, 2015

Objective C Concepts Learning

Objective C Blocks

What is Block;

Block is an anonymous function in Objective C.

Blocks can be used as below:

As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};

As a property:
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);

As a method parameter:
- (void)someMethodThatTakesABlock:(returnType (^)(parameterTypes))blockName;

As an argument to a method call:
[someObject someMethodThatTakesABlock:^returnType (parameters) {...}];

As a typedef:
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};


Important Concepts of Blocks

-          Blocks will freeze the variables which are accessed from outside the block. It will make the variable as constant with the value assigned to it.

 NSString *variable = @"Madhavan";

-          To allow blocks to make the variable as mutable we need to declare as below

__block NSString *variable = @"Madhavan";

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use of @ in Objective C

@ is a keyword used to differentiate Objective C keywords from C or C++ keywords.


@ symbol tell the compiler it is as Objective C construct and not the C or C++ construct.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Autoreleasepool in Objective C

autoreleasepool is used to retain or release the object created by the developer. Whenever the loop increaments the autorelease pool make the reference count +1 and -1 when the loop finish the task.

Wednesday, January 2, 2013

Add UDID to Provisioning Profile of IOS Mobile and Tablet

Steps to add UDID to provisioning profile.

Login to apple member center from here https://developer.apple.com/

Apple Developer --> Member Center --> iOS Provisioning --> Add Devices

Add UDID with a meaningful name 

Create a Provisioning Profile that includes all of your registered devices

Open your Xcode, Go to the Organizer Select the Provisioning Profiles section and select the specific profile

Check the box "Automatic Device Provisioning"

Press the Refresh button