120th Day As An iOS Developer

February 25, 2016 - 120th Day As An iOS Developer

THURSDAY - First of all, I hope my manager won't be at the office tomorrow, just kidding. My senior (the part-time) and I realised that we can accomplish more tasks if the manager is not here. Anyway, let me just share you what I learned today: FACEBOOK ANALYTICS. It's easy, I'll make a tutorial next time about this. It's very useful, so I comment Facebook for providing this function along with their Facebook SDK for iOS. Thank you Facebook!

Also, I would like to share to you my thought for the day:

The non-technicality of the people, I mean, the client leads to their own expenses. I just realised that today. I saw the website my officemates have been working on for the client. It’s quite simple. I guess the advantage of making this company as the maker of their website is the SEO. That’s my best bet.

FIN.

How To Fetch All Data From Facebook Using FBLoginView iOS

photo from Speedoox
Hi, welcome again to my new tutorial. How to get all data from Facebook using LoginView - iOS Objective-C.

Thinking about the time when I was discovering how to fetch all the data using LoginView from Facebook to iOS makes me laugh. Why? Because I spent almost 3 hours solving my problem. I wasn't able to get even a Facebook Profile Picture. Ughhh... But now, I am sharing this to you guys. If you want to send me your gratitude, just post it in the comment section below of the post :) or subscribe or share.

I have removed some parts of my codes here because this is actually for my project in the office. NDA issue lol. Okay, so I am using FBLoginView. Now, there are lots of answers posted on stackoverflow, but most of them didn't work to me. Facebook provides many ways or rather many kinds of SDK to use on iOS. Let's get started.

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id)user
{
    NSURL *smallResPicURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=small",user.id]];
    NSLog(@"%@", smallResPicURL);

    // Start Fetching Data...
    [FBRequestConnection startWithGraphPath:@"me" parameters:[NSMutableDictionary dictionaryWithObjectsAndKeys:@"id,first_name,last_name,email,picture.width(720).height(720)",@"fields",nil] HTTPMethod:@"GET" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        NSDictionary *userData = (NSDictionary *)result;
        NSLog(@"%@",[userData description]);
        
        id picture = result[@"picture"];
        id data = picture[@"data"];
        id url = data[@"url"];
        
        
        FBProfilePictureURL = url;
        FBEmail = [userData objectForKey:@"email"];
        FBFirstName = [userData objectForKey:@"first_name"];
        FBLastName = [userData objectForKey:@"last_name"];
        NSLog(@"FB EMAIL: %@", FBEmail);
        NSLog(@"FB FIRST NAME: %@", FBFirstName);
        NSLog(@"FB LAST NAME: %@", FBLastName);
        NSLog(@"FB PROFILE PIC URL: %@", FBProfilePictureURL);
                

        // Prevents the bug - pushing the vc twice or more.
        
        if (!createProfileIsPushed)
        {
            NSLog(@"createProfileIsPushed: %hhd", createProfileIsPushed);
            CreateProfileViewController *createProfile = [[CreateProfileViewController alloc] init];
            [self.navigationController pushViewController:createProfile animated:YES];
            
            createProfileIsPushed = YES;
        }

    }];


}

The code is is pretty simple, in fact, you can just copy and pasted it, except the last part of the code, starting from the "//prevents the bug". I am pushing a new ViewController here, however, the viewcontroller was being pushed twice or more, so I just made a quite dirty way, is it dirty? So, there you go. All the data (well technically not all the data) from Facebook is being sent here. Check out my NSLogs in my code. If you want something more to be fetched, just add it in the dictionaryWithObjectsAndKeys. Contact me if you don't understand anything here.

27th Day As An iOS Developer With No Experience



October 12, 2015 - 27th Day As An iOS Developer With No Experience.

MONDAY - I’m so happy that I learned so many things today, I wanna share those to you. Although I felt that I have wasted so much time, like 5 hours or so, just for aligning the elements or objects in my one view controller.

Things that I’ve learned:
- Logout from Facebook.
- Easy alignment of UI Elements without using constraints or auto layout.
- Dismissal of Keypad.

Now, I will try later to finish these 3 tutorials before leaving the office. It is really hard to maintain a blog you know? Blogging while working full time. It's hard. It's tough to pretend that you are good in English. Just kidding. But seriously though, I'm not good. I will just publish this post for now, and then edit it later for providing the links for these 3 tutorials.