jeyben / IOSLinkedInAPI

Simple and non intrusive library to get access tokens for LinkedIn using Oauth2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not showing Login Window for LinkedIn API in iOS

AnilkumarRabhasa opened this issue · comments

Mr. Jeyben, thanks for sharing great api for integrating the LinkedIn Api to iOS apps. This saves my time for integarting to my app. Yesterday i downloaded this api and i got user info from LinkedIn. Today i opend my app, the login window not showing after clicking the button. Its very strange to me really, i checked my code perfectly, i dint changed anything. Could you pls give solution for this, Thanks in advanced.

Hi,

I haven’t tested in in iOS 8, maybe it is related to the new iOS version?

Regards Jacob
On 23 Sep 2014, at 12:45, AnilkumarRabhasa notifications@github.com wrote:

MR. Jeyben, thanks for sharing great api for integrating the LinkedIn Api to iOS apps. This saves my time for integarting to my app. Yesterday i downloaded this api and i got user info from LinkedIn. Today i opend my app, the login window not showing after clicking the button. Its very strange to me really, i checked my code perfectly, i dint changed anything. Could you pls give solution for this, Thanks in advanced.


Reply to this email directly or view it on GitHub.

Ok. Thanks for your quick response. But, yesterday its opend, but very strange its not opening today. I think iOS 8 its not issue, any other suggestions to me

finally I found the issue. The issue in Library file of "LIALinkedInHttpClient.m" file of following method

  • (void)showAuthorizationView:(LIALinkedInAuthorizationViewController *)authorizationViewController {
    if (self.presentingViewController == nil)
    self.presentingViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;

    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:authorizationViewController];

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
    nc.modalPresentationStyle = UIModalPresentationFormSheet;
    }

    [self.presentingViewController presentViewController:nc animated:YES completion:nil];

}
and the error is below while clicking the login button its showing, due to this LinkedIn Loginview is not coming
Warning: Attempt to present <UINavigationController: 0x7be57010> on <myviewcontroller: 0x7bfb2970> whose view is not in the window hierarchy!

in the line of error is
[self.presentingViewController presentViewController:nc animated:YES completion:nil];

Any chances, this would be fixed anytime soon?

i fixed above issue by myself. in my app, i have intropage in that page i have skip button with action, after clicked skip action, i am displaying login with linkedin, so, i added for skip action following code
-(IBAction)skipTourAction:(id)sender
{
AppDelegate appDel=(AppDelegate)[[UIApplication sharedApplication] delegate];
LoginViewController *loginVC=[[LoginViewController alloc] init];
appDel.window.rootViewController=loginVC;
[appDel.window makeKeyAndVisible];
}

using above code, i fixed my issue. I hope @tasveer it would help you. i just added window again my viewcontroller. I dont know this is good practise or not but i fixed my issue in XCode 6 using that code. Thats All and all the best!

Hi jayben ,

Please guide me in implementing the IOSLinkedinAPI .
I am getting the following error.
AFHTTPClient.h file not found

You are missing the afnetworking dependency.
Are you not using the pod?

Regards Jacob

Den 17/10/2014 kl. 13.29 skrev rajeshsingh90 notifications@github.com:

Hi jayben ,

Please guide me in implementing the IOSLinkedinAPI .
I am getting the following error.
AFHTTPClient.h file not found


Reply to this email directly or view it on GitHub.

Hi Jayben,

Which version of AFNetwork are you using.
Yes i am using cocoapods and i am using iOS 8

I am using AFNetwork 2.2.1 and i think several files are missing in this version

Please guide me

Which version of the ioslinkedinapi are you using? The version 2.0.0 should be compatible with afnetworking 2.x and not have a dependency to afhttpclient.h (which was removed in the 2.x of afnetworking).

Regards Jacob

On 17 Oct 2014, at 14:10, rajeshsingh90 notifications@github.com wrote:

Hi Jayben,

Which version of AFNetwork are you using.
Yes i am using cocoapods and i am using iOS 8

I am using AFNetwork 2.2.1 and i think several files are missing in this version

Please guide me


Reply to this email directly or view it on GitHub.

Hi Jeyben,
Now i am using ioslinkedinapi version 2.0 and have all the dependent files
but now it shows me the following error
AFHTTPRequestOperationManager.h file not found

and Jeyben please tell me all the dependent libraries used in ioslinkedinapi

Could you please tell me the doc for this

As The podspec states, the only dependency to a third party library is afnetworking version 2.x:
https://github.com/jeyben/IOSLinkedInAPI/blob/master/IOSLinkedInAPI.podspec

Your error tells me that you aren't compiling with afnetworking version 2.x as AFHTTPRequestOperationManager.h is part of version 2.x.

Regards Jacob

Den 17/10/2014 kl. 19.34 skrev rajeshsingh90 notifications@github.com:

Hi Jeyben,
Now i am using ioslinkedinapi version 2.0 and have all the dependent files
but now it shows me the following error
AFHTTPRequestOperationManager.h file not found

and Jeyben please tell me all the dependent libraries used in ioslinkedinapi

Could you please tell me the doc for this


Reply to this email directly or view it on GitHub.

Hi Jeyben,

I have implemented the ioslinkedinAPI with my app. I have written the code in swift. I ma able to get access token and linkedin data of user profile.

But there is one error in function getAccessToken in success callback.
I am trying to get NSDictionary but it gets me the following error

'[NSObject : AnyObject]' is not identical to 'NSDictionary'

My code is :

self.Lclient.getAccessToken(code,success: { (accessTokenData:NSDictionary!) -> Void in
// var accessToken:NSString! = accessTokenData.objectForKey("access_token")
// self.requestMeWithToken(accessToken)
}, failure: { (error:NSError!) -> Void in
println("Quering accessToken failed = (error)")
})

Please jeyben guide me where i am wrong

and it happens only first time after that accessToken is valid as you have stored it in NSUserDefaults

one more thing jeyben,

if i am using this code then there is no error but i don't know from where to get accessToken

self.Lclient.getAccessToken(code,success: { ([NSObject:AnyObject]!) -> Void in
// var accessToken:NSString! = accessTokenData.objectForKey("access_token")
// self.requestMeWithToken(accessToken)
}, failure: { (error:NSError!) -> Void in
println("Quering accessToken failed = (error)")
})

Hey jeyben,

Its done. Thanks for this library.

Any solution? I'm having the same problem..

Is there any solutions for this?

I had the same problem. Then I figured out that I was not using this library correctly by initializing the instance of LIALinkedInHttpClient with
[LIALinkedInHttpClient clientForApplication:application presentingViewController:nil];

Replacing the above "nil" to "self" solved the problem.

Thank you Jeyben for this great library!