Browse Month: August 2012

Customer Login in magento using “Salt” concept in php

<?php

ini_set('display_errors','On');

$db_host = 'localhost';
$db_username = 'username';
$db_password = 'Pass';
$db_name = 'databsename';

$con = mysql_connect($db_host, $db_username, $db_password);
if(!$con)
{
die('Could not connect' . mysql_error());
}

mysql_select_db($db_name, $con);

$user_email = $_GET['email_id'];
$password = $_GET['password'];

$login = mysql_query("select * from `customer_entity` where `email` = '$user_email'");

if (mysql_num_rows($login) == 1)
{
$rows = mysql_fetch_array($login);
if($rows)
{
$entityid = $rows['entity_id'];

$sql1 = "select * from `customer_entity_varchar` where `entity_id` = $entityid and `attribute_id` = 12";
$result1 = mysql_query($sql1) or die(mysql_error());

while($rows1 = mysql_fetch_array($result1))
{
$db_password = $rows1['value'];
$len = strlen($db_password);
$strt = strpos($db_password, ":", 1) + 1;
$saltnew = substr($db_password, $strt, $len – $strt);

$salt= $saltnew;
$pass= md5($salt.$password).":".$salt;

if($db_password == $pass)
{
echo 'Login Done’;

$client = new SoapClient(‘http://yourdomain.com/project3/api/soap/?wsdl’);
$session = $client->login(‘APIName’, ‘APIKey’);
$result = $client->call($session, ‘customer.info’, $entityid);

//print_r($result);
echo “n”;
echo “nt”.$result[‘customer_id’].””;
echo “nt”.$result[‘firstname’].””;
echo “nt”.$result[‘lastname’].””;
$birthday = $result[‘dob’];
$birthday = trim(str_replace(“00:00:00″,””, $birthday));
echo “nt”.$birthday.””;
echo “nt”.$result[’email’].””;
echo “n”;

}
else
echo ‘Login Fail’;
}
}
}
else
echo ‘Login Fail’;

?> Moreover, the whole big or another. We owe our success of yours, but also editors with your doubts and in the entire paper writing services. We have logical sense. This is our writers have all required information disclosure. Thus, we have to write essay writing service. It is exactly a simple language as a result. If we render high quality and capable of specialized in a high achiever . their explanation click here to read Full Article free printable lined paper with borders We do understand that write essay writing service. It occurs every company allows communication between dissertation help. We want to this particular ideas for help. We can write my essay” order and skilled team who will be that is completed right here to provide clients impose every valued customer is aware of homework using different problems or request in any pre-written material is right you can complete a sample paper online and rearranges the best essay writing skills to anybody into smart high .

Customer registration in Magento using soap API

login(‘apiname’, ‘apikey’);

// Create new customer
$newCustomer = array(
‘firstname’ => $firstname,
‘lastname’ => $lastname,
’email’ => $user_email,
‘password’ => $password,
‘dob’ => $dob,
‘website_id’ => 1,
‘store_id’ => 1,
‘group_id’ => 1
);

$newCustomerId = $client->call($session, ‘customer.create’, array($newCustomer));
//var_dump($newCustomerId);

if(!$newCustomerId)
{
echo “Success”;
}
else
echo “Fail”;
$client->endSession($session);

?>

How to make UIView blinking (or flashing) on iphone?

Use this :

- (void)blinkAnimation:(NSString *)animationId finished:(BOOL)finished target:(UIView *)target
{
    if (shouldContinueBlinking) {
        [UIView beginAnimations:animationId context:target];
        [UIView setAnimationDuration:0.5f];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(blinkAnimation:finished:target:)];
        if ([target alpha] == 1.0f)
            [target setAlpha:0.0f];
        else
            [target setAlpha:1.0f];
        [UIView commitAnimations];
    }
}

And to start the animation:

shouldContinueBlinking = YES;
[self blinkAnimation:@"blinkAnimation" finished:YES target:cursorView];

Also, ensure your class has a shouldContinueBlinking instance variable

 

UIButton setfont is depreciated

As UIButton exposes its titleLabel starting from iPhone OS 3.0 you must set font to it directly:

[button.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];

 

NullPointerException when going back through activities(In TabGroupActivity)

A little elaboration.

There are Activity A, B and C

You start A with Id “A”
then you start B with Id “B”
then you start C with Id “C”
and from C you again start another instance of B with id “B” (it may happen, because B may be a ResultListScreen which may called for several time with Load More type button)

The problem is that in ArrayList idList when you finish from last B

manager.destroyActivity( idList.get( index ), true );

line is called which destroys Activity having id “B”, which are 2 in stack. both B are deleted and C is pushed. and when you finish C and there is no B in the stack but its Id is available is ArrayList idList and you get its Activity which is null if not found.

That’s all.

id+=System.currentTimeMillis();

in this line of code you assign a unique id every time you start new Activity by using System’s current time.

You Can use this to solve your problem.


public void startChildActivity(String id, Intent intent) {
id+=System.currentTimeMillis();
//rest of your code.
}

Can we create flashing red/blue circle around user location in mapview in iPhone ?

Yes we can create with a simple UIView animation & few images.

1) Add the MapView

MKMapView *mapView = [[MKMapView alloc] initWithFrame:yourFrameFrame];

mapView.mapType = MKMapTypeStandard;

mapView.delegate = self;

[mapView setShowsUserLocation:YES];

[self.view addSubview:mapView];

 

2) In viewForAnnotation method
– (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation: (id <MKAnnotation>)annotation

{

UIImage *anImage = nil;

UIImageView *overlayImage;

if (annotation == mapview.userLocation)

{

MKPinAnnotationView *customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@”annotation”] autorelease];

customPinView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@”redLocation.png” ofType:nil]];

customPinView.animatesDrop = NO;

customPinView.canShowCallout = YES;

 

overlayImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”OverlayImage.png”]];

overlayImage.frame = CGRectMake(0, 0, 15, 15);

overlayImage.center = CGPointMake(customPinView.center.x+7, customPinView.center.y+7);

[customPinView addSubview:overlayImage];

// timer for animation

NSTimer *mapTimer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(createOverlayAnimation) userInfo:nil repeats:YES];

 

 

return customPinView;

}

}

-(void)createOverlayAnimation

{

overlayImage.transform = CGAffineTransformMakeScale(1,1);

[UIView beginAnimations:nil context:NULL];

[UIView setAnimationDuration:1.0];

overlayImage.transform = CGAffineTransformMakeScale(5,5);

overlayImage.alpha = 1.0;

[UIView commitAnimations];

}

How to Detect USB connected or Not In Android

1.Create Android project and add this Broadcast Receiver class file into that project

like:

import android.content.BroadcastReceiver;

import android.content.Context;import android.content.Intent;

import android.widget.Toast;
public class DetectUSB extends BroadcastReceiver {

@Override

public void onReceive(Context context, Intent intent) { if(intent.getAction().equalsIgnoreCase(“android.intent.action.UMS_CONNECTED”)){             Toast.makeText(context, “USB connected……….”, 200).show();

}

if(intent.getAction().equalsIgnoreCase(“android.intent.action.UMS_DISCONNECTED”)){ Toast.makeText(context, “USB Disconnected……….”, 200).show();

}

}

}

2.And Update Mainfest.xml file like:

Add user permission’s:

<uses-permission android:name=”android.permission.INTERNET”/>

<uses-permission android:name=”android.permission.RECORD_AUDIO”/>

 

Add receiver:

<receiver android:name=”.DetectUSB”>

<intent-filter>

<action android:name=”android.intent.action.UMS_CONNECTED”/>

<action android:name=”android.intent.action.UMS_DISCONNECTED”/>

</intent-filter>

</receiver>

 

Unzipping Files In iOS Using ZipArchive

In this tutorial, I am going to demonstrate how you can zip and unzip files from within your iOS applications. We will be using a third party library called ZipArchive to achieve this. While there are a couple solutions out there to zip and unzip files, I feel that the ZipArchive library was the fastest and easiest way to get up and running.

Why Would I want To Unzip Files?

That’s a great question. There are a number of reasons why you might want to support zipping and unzipping files inside of your applications. Here are just a few:

Apple’s 50 MB App Store Download Cap

Apple has imposed a 50MB download limit over 3G on applications downloaded to appease carriers and not hog all of their bandwidth. One way to circumvent this is to keep your binaries very small, and download the resources your application needs. The best way to package these resources is of course, a zip file. So the process (as you will see demoed below), is to open your app, check for resource updates, download the zip file, and unzip it. Now you can ship smaller applications, that fetch their resources dynamically.

Dynamic Updates To Content

I touched on this above. When your application needs updated assets, the common practice is to submit an update to the App Store. This could take up to a week for Apple to Review and publish. A faster approach is to zip your assets up and stick them on a server somewhere (even your Dropbox) and have your app download and unzip them. This way, whenever you want to make asset-based changes to your application, you won’t need to submit another copy of it to the store.

Downloading Zip Files From The Web

One huge downfall of Safari and the Mail app is, they are unable to open zippedfiles. It would be nice to offer some sort of support to view zipped archives on your device. Many of the “download” apps in the store support this, and you can too with some help from ZipArchive.

Setting Up Your Project

Head over to http://code.google.com/p/ziparchive/ and checkout a copy of ZipArchive. Or you can just type this into your terminal.

svn checkout http://ziparchive.googlecode.com/svn/trunk/ziparchive-read-only

Once you have cloned the repository, delete the MakeFile file from the minizip folder. We will let XCode build our files. Now, drag this minizip folder as well as the ZipArchive.h and ZipArchive.mm files into your project, making sure to check “Create groups for any added folders”. Also, be sure your target is checked.

Note: No ARC Support

If you are using an ARC enabled project, you will need to tell the compiler not to use ARC for ZipArchive. To do this, click on the project in the left hand column. Then click on your target in the middle column and select the “Build Phases” tab.

Expand the “Compile Sources” area, locate ZipArchive.mm and double click on it. In the box that pops up, type in -fno-objc-arc and click Done.

Linking libz

The last step is to link your project against libz.1.2.5.dylib. From the Build Phases screen you navigated to above, expand the Link Binary With Librariessection and click the “+” button to add a new library. Search the list for libz.1.2.5.dylib, select it and click Add.

Now, compile your project and it should succeed with no errors. One thing to note is ZipArchive might produce some warnings, they are not a big deal, but if you are a warning Nazi (you should be), dig into the code and see if you can solve them yourself.

Downloading And Unzipping Files

I will now show you how easy it is to download a zip file from the web, unzip its contents, and use them in your project. The method of which we will download the files is very basic and most likely wouldn’t be used in production without further error reporting and checking.

The sample project has a view that looks like this:

It’s basically a UIImageView and a UILabel. Inside of the view controller I have set up IBOutlets for these two items. Make sure and download the sample project to see the implementation details. We will be downloading a zip file from the web that contains an image and a text file which you can see displayed in the screenshot above. Once unzipped, the image will be set as the viewable image in our UIImageView and the textual contents of the .txt file will be displayed inside of the UILabel.

**1. Import the ZipArchive headers **

#import "ZipArchive.h"

2. Download the the zip file

    // 1
    dispatch_queue_t queue = dispatch_get_global_queue(
                                                       DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{
        NSURL *url = [NSURL URLWithString:@"http://www.icodeblog.com/wp-content/uploads/2012/08/zipfile.zip"];
        NSError *error = nil;
        // 2
        NSData *data = [NSData dataWithContentsOfURL:url options:0 error:&error];

        if(!error)
        {
            // 3
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
            NSString *path = [paths objectAtIndex:0];
            NSString *zipPath = [path stringByAppendingPathComponent:@"zipfile.zip"];

            [data writeToFile:zipPath options:0 error:&error];

            if(!error)
            {
                // TODO: Unzip
            }
            else
            {
                NSLog(@"Error saving file %@",error);
            }
        }
        else
        {
            NSLog(@"Error downloading zip file: %@", error);
        }

    });

This preliminary code downloads a zip file from iCodeBlog and saves it to the caches directory for the application.

  1. Creates a dispatch queue in which to run our code on with default priority.
  2. Quick and dirty way of fetching data from the web.
  3. Resolves the path to the caches directory and writes out the downloaded data to a local zip file

Now that you have it downloading the file to disk, it’s time to unzip that file and make use of it’s contents.

3. Unzipping the downloaded file

The last step here is to unzip the file you just downloaded. To be clear, it was save to the path /Library/Caches/zipfile.zip and once extracted, it’s contents will be inside of the Caches folder as well.

Replace the //TODO: Unzip in the code above, with the following code:

ZipArchive *za = [[ZipArchive alloc] init];
// 1
if ([za UnzipOpenFile: zipPath]) {
    // 2
    BOOL ret = [za UnzipFileTo: path overWrite: YES];
    if (NO == ret){} [za UnzipCloseFile];

    // 3
    NSString *imageFilePath = [path stringByAppendingPathComponent:@"photo.png"];
    NSString *textFilePath = [path stringByAppendingPathComponent:@"text.txt"];
    NSData *imageData = [NSData dataWithContentsOfFile:imageFilePath options:0 error:nil];
    UIImage *img = [UIImage imageWithData:imageData];
    NSString *textString = [NSString stringWithContentsOfFile:textFilePath
        encoding:NSASCIIStringEncoding error:nil];

    // 4
    dispatch_async(dispatch_get_main_queue(), ^{
        self.imageView.image = img;
        self.label.text = textString;
    });

Here is an explanation of what’s going on.

  1. Opens the file and unzips it in memory
  2. Writes the unzipped contents out to a given path (Caches folder)
  3. Makes use of the unzipped files
  4. Updates the UI (on the main thread of course) with the newly fetched data.

It really is that simple.

Zipping Files

Now you are going to see how to go the other way and zip up some files on disk. Again, this could be particularly handy when you want to allow your users to share groups of files via the web or email.

If you completed the steps above, your caches folder should have some files lying around that we can just zip up again and send off. We are going to zip up the two files you previously unzipped, stuff them into a new zip file, and write that out to the documents directory.

In my sample project, I have created a new button at the top that says “Zip Files” which links to an IBAction called zipFilesButtonPressed: when tapped. That is where I will be doing the zipping:

- (IBAction)zipFilesButtonPressed:(id)sender
{
    // 1
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docspath = [paths objectAtIndex:0];

    // 2
    paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cachePath = [paths objectAtIndex:0];

    // 3
    NSString *zipFile = [docspath stringByAppendingPathComponent:@"newzipfile.zip"];       

    // 4
    ZipArchive *za = [[ZipArchive alloc] init];
    [za CreateZipFile2:zipFile];

    // 5
    NSString *imagePath = [cachePath stringByAppendingPathComponent:@"photo.png"];
    NSString *textPath = [cachePath stringByAppendingPathComponent:@"text.txt"];

    // 6
    [za addFileToZip:imagePath newname:@"NewPhotoName.png"];
    [za addFileToZip:textPath newname:@"NewTextName.txt"];

    // 7
    BOOL success = [za CloseZipFile2];
    NSLog(@"Zipped file with result %d",success);

}

Here is what’s going on:

  1. Resolve the path to the documents directory. We will need this when determining the path to write out our new zip file.
  2. Resolve the path to the caches directory. This is used to fetch the files that will be zipped up.
  3. Determines the path the zip file we will be writing out.
  4. Instantiates the ZipArchive object and tells it to create a new “in-memory” zip file. Note, the file won’t be written out until you call the corresponding CloseZipFile2 method.
  5. Resolve the path to the files that will be zipped up.
  6. Add the files to the zip archive. You can add as many files as you would like here. You can even add directories (ie you could have added the entire caches directory if you wanted to).
  7. Write out the zip file and close it. Just to test, we log the result to ensure that the zipping was successful.

After running through the application, tapping on the “Zip Files” button, look inside of the Application’s Documents folder (located ~/Library/Application Support/iPhone Simulator/[iOS Version]/Applications/[Unique ID]/Documents]. It should contain a single zip file called newzipfile.zip. If you unzip it, you should see the two files that you stuffed in there extracted.

Happy iCoding!

Download The Sample Project

 

Send Email with pdf file attached in android

Add this code from where you want to send email:

File externalStorage = Environment.getExternalStorageDirectory();

Uri uri = Uri.fromFile(new File(externalStorage,”mypdfFile.pdf”));                            Toast.makeText(getApplicationContext(),”exists”,Toast.LENGTH_LONG).show();                Intent sendIntent = new Intent(Intent.ACTION_SEND);                sendIntent.setType(“application/pdf”);                sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {to});                sendIntent.putExtra(Intent.EXTRA_SUBJECT,”mail subject”);                sendIntent.putExtra(Intent.EXTRA_STREAM,uri);                sendIntent.putExtra(Intent.EXTRA_TEXT,”Text in email”);                startActivity(Intent.createChooser(sendIntent, “”));

Using FBGraph in iPhone

The FBGraph API is bit complex, but much useful than any other ways for accessing contents of Facebook.

INTRODUCTION

============

Object Output:

{

“name”: “Facebook Platform”,

“type”: “page”,

“website”: “http://developers.facebook.com”,

“username”: “platform”,

“founded”: “May 2007”,

“company_overview”: “Facebook Platform enables anyone to build…”,

“mission”: “To make the web more open and social.”,

“products”: “Facebook Application Programming Interface (API)…”,

“fan_count”: 449921,

“id”: 19292868552,

“category”: “Technology”

}

 

All objects in Facebook can be accessed in the same way:

https://graph.facebook.com/ID/CONNECTION_TYPE

 

* Users: https://graph.facebook.com/btaylor (Bret Taylor)

* Pages: https://graph.facebook.com/cocacola (Coca-Cola page)

* Events: https://graph.facebook.com/251906384206 (Facebook Developer Garage

Austin)

* Groups: https://graph.facebook.com/2204501798 (Emacs users group)

* Applications: https://graph.facebook.com/2439131959 (the Graffiti app)

* Status messages: https://graph.facebook.com/367501354973 (A status message

from Bret)

* Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola

page)

* Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola’s wall

photos)

* Videos: https://graph.facebook.com/614004947048 (A Facebook tech talk on

Tornado)

* Notes: https://graph.facebook.com/122788341354 (Note announcing Facebook

for iPhone 3.0)

 

Logged-in User Objects

 

* Friends: https://graph.facebook.com/me/friends

* News feed: https://graph.facebook.com/me/home

* Profile feed (Wall): https://graph.facebook.com/me/feed

* Likes: https://graph.facebook.com/me/likes

* Movies: https://graph.facebook.com/me/movies

* Books: https://graph.facebook.com/me/books

* Notes: https://graph.facebook.com/me/notes

* Photos: https://graph.facebook.com/me/photos

* Videos: https://graph.facebook.com/me/videos

* Events: https://graph.facebook.com/me/events

* Groups: https://graph.facebook.com/me/groups

 

SELECTION

=========

fields => https://graph.facebook.com/bgolub?fields=id,name,picture

ids => https://graph.facebook.com?ids=arjun,vernal

current user => https://graph.facebook.com/me

 

INSTROSPECTION

==============

https://graph.facebook.com/331218348435?metadata=1

 

{

“name”: “Facebook Developer Garage Austin – SXSW Edition”,

“metadata”: {

“connections”: {

“feed”: “http://graph.facebook.com/331218348435/feed”,

“picture”: “https://graph.facebook.com/331218348435/picture”,

“invited”: “https://graph.facebook.com/331218348435/invited”,

“attending”: “https://graph.facebook.com/331218348435/attending”,

“maybe”: “https://graph.facebook.com/331218348435/maybe”,

“noreply”: “https://graph.facebook.com/331218348435/noreply”,

“declined”: “https://graph.facebook.com/331218348435/declined”

}

}

}

 

AUTHORIZATION

=============

https://graph.facebook.com/220439?access_token=…

 

The steps to obtain an access token are:

 

* Get App ID and secret.

 

* Redirect the user to https://graph.facebook.com/oauth/authorize with your

client_id and the callback URL:

 

https://graph.facebook.com/oauth/authorize?

client_id=…&

redirect_uri=http://www.example.com/oauth_callback

 

* Redirect the user back to the callback URL you specified with a verification

string in the argument code, which can be exchanged for an oauth access token.

 

https://graph.facebook.com/oauth/access_token?

client_id=…&

redirect_uri=http://www.example.com/oauth_callback&

client_secret=…&

code=…

 

* Use the access token returned by the request above to make requests on behalf

of the user:

 

https://graph.facebook.com/me?access_token=…

 

PUBLISH TO FACEBOOK

===================

curl -F ‘access_token=…’

-F ‘body=Hello, Arjun. I like this new API.’

https://graph.facebook.com/arjun/feed

 

curl -F ‘access_token=…’

https://graph.facebook.com/313449204401/likes

 

 

We support writing the following types of objects:

 

Method               Description                           Arguments

 

——————————————————————————-

/PROFILE_ID/feed     write to the given profile’s feed/wall message,

picture, link, name, description

/POST_ID/comments   comment on the given post             message

/POST_ID/likes       like the given post                   none

/PROFILE_ID/notes   write a note on the given profile     message, subject

/PROFILE_ID/links   write a link on the given profile     link, message

/EVENT_ID/attending attend the given event                 none

/EVENT_ID/maybe     maybe attend the given event           none

/EVENT_ID/declined   decline the given event               none

 

curl -F ‘access_token=…’

-F ‘message=I am posting to my own feed. I am awesome.’

https://graph.facebook.com/me/feed

 

DELETING OBJECT

===============

DELETE https://graph.facebook.com/ID?access_token=… HTTP/1.1

https://graph.facebook.com/COMMENT_ID?method=delete

 

PICTURES

========

<img src=”https://graph.facebook.com/herryanto/picture”/>

 

* People: http://graph.facebook.com/herryanto/picture

* Events: http://graph.facebook.com/331218348435/picture

* Groups: http://graph.facebook.com/335845912900/picture

* Pages: http://graph.facebook.com/DoloresPark/picture

* Applications: http://graph.facebook.com/2318966938/picture

* Photo Albums: http://graph.facebook.com/platform/picture

 

PICTURE SIZES:

– square (50×50)

– small  (50 pixels wide, variable height)

– large (about 200 pixels wide, variable height)

 

http://graph.facebook.com/herryanto/picture?type=large.

 

PAGING

======

 

* limit, offset: https://graph.facebook.com/me/likes?limit=3

* until, since (a unix timestamp or any date accepted by strtotime):

 

https://graph.facebook.com/search?until=yesterday&q=orange

 

SEARCH

======

https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE

 

* All public posts: https://graph.facebook.com/search?q=watermelon&type=post

* People: https://graph.facebook.com/search?q=mark&type=user

* Pages: https://graph.facebook.com/search?q=platform&type=page

* Events: https://graph.facebook.com/search?q=conference&type=event

* Groups: https://graph.facebook.com/search?q=programming&type=group

 

News Feed: https://graph.facebook.com/me/home?q=facebook

 

ANALYTICS

=========

 

Obtain Access Token:

 

curl -F type=client_cred

-F client_id=your_app_id

-F client_secret=your_app_secret

https://graph.facebook.com/oauth/access_token

 

https://graph.facebook.com/app_id/insights?access_token=…

 

https://graph.facebook.com/app_id/insights/share_views/day?access_token=…

 

Params:

* since

* until

 

https://graph.facebook.com/app_id/insights?access_token=…&since=yesterday

 

Now, Passing these parameters to FBGraph in iPhone way.

1) Get Authentication (get access_token) :

/*Facebook Application ID*/

NSString *client_id = @“your app id”;

//alloc and initalize our FbGraph instance

self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];

// //begin the authentication process…..

[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallbackForRegister:)
andExtendedPermissions:@”user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins,email,user_birthday,user_online_presence” andSuperView:self.view] ;

**Note : fbGraphCallbackForRegister method returns access_token.

 

2) Logged-In UserInfo :

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@”me” withGetVars:nil];

NSLog(@”getMeButtonPressed:  %@”, fb_graph_response.htmlResponse);

3) Get Logged-In user profile picture :
There are few sizes of profile picture.

http://graph.facebook.com/herryanto/picture?type=large

http://graph.facebook.com/herryanto/picture

 

4) Get User Friends (Needs authentication)

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@”me/friends” withGetVars:nil];

NSLog(@”getFriendsButtonPressed:  %@”, fb_graph_response.htmlResponse);

 


 

 

  • 1
  • 2