Foren
'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Richard Reyes, geändert vor 8 Jahren.
'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 2 Beitrittsdatum: 08.12.15 Neueste Beiträge
Hi All,
I am trying to run this code:
I'm using Xcode Version 7.2.1 , with cocoapod 'Liferay-iOS-SDK', '~> 7.0'
My problem is I am not getting any "success" response. So I debugged the SDK and found out that, I think the signInWithSession method is missing a success callback?
My issue is gone after I added this line above: line 44
So I am not sure how to handle this, I know I can't just update the source code, can I request for this?
Is there a reasoning or a workaround ?
Thanks
I am trying to run this code:
let authentication = LRBasicAuthentication(username: "test@liferay.com", password: "test")
let session = LRSession(server: "http://x.x.x.x", authentication: authentication)
session.onSuccess({ (result) -> Void in
print("success")
})
{ ( fail ) -> Void in
print("fail \(fail)")
}
var errorx:NSError?
LRSignIn.signInWithSession(session, callback: session.callback, error:&errorx )
I'm using Xcode Version 7.2.1 , with cocoapod 'Liferay-iOS-SDK', '~> 7.0'
My problem is I am not getting any "success" response. So I debugged the SDK and found out that, I think the signInWithSession method is missing a success callback?
+ (void)signInWithSession:(LRSession *)session callback:(id<lrcallback>)callback
method:(LRSignInMethod)method error:(NSError **)error {
LRGroupService_v7 *service = [[LRGroupService_v7 alloc]
initWithSession:session];
[session
onSuccess:^(NSArray *groups) {
if ([groups count] == 0) {
*error = [LRError errorWithCode:LRErrorCodeUnauthorized
description:@"User doesn't belong to any site"];
return;
}
NSDictionary *site = [groups objectAtIndex:0];
long long companyId = [site[@"companyId"] longLongValue];
LRSession *userSession = [[LRSession alloc]
initWithSession:session];
[userSession setCallback:callback];
LRUserService_v7 *userService = [[LRUserService_v7 alloc]
initWithSession:userSession];
NSString *username = [self _getUsername:session];
if (method == LRSignInMethodEmail) {
[userService getUserByEmailAddressWithCompanyId:companyId
emailAddress:username error:error];
}
else if (method == LRSignInMethodUserID) {
long long userId = [username longLongValue];
[userService getUserByIdWithUserId:userId error:error];
}
else if (method == LRSignInMethodScreenName) {
[userService getUserByScreenNameWithCompanyId:companyId
screenName:username error:error];
}
[callback onSuccess:nil];
}
onFailure:^(NSError *e) {
[callback onFailure:e];
}
];
[service getUserSitesGroups:error];
}
</lrcallback>
My issue is gone after I added this line above: line 44
[callback onSuccess:nil];
So I am not sure how to handle this, I know I can't just update the source code, can I request for this?
Is there a reasoning or a workaround ?
Thanks
Jose M. Navarro, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Regular Member Beiträge: 138 Beitrittsdatum: 24.01.14 Neueste Beiträge
Try with version 7.0.4.
Bruno fixed a bug that may be related with that
Regards
Bruno fixed a bug that may be related with that
Regards
Richard Reyes, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 2 Beitrittsdatum: 08.12.15 Neueste Beiträge
Thank you. It is fixed in 7.0.4
Best
Best
Daniel Wong, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 5 Beitrittsdatum: 19.04.16 Neueste Beiträge
Being new to liferay, I wasted a few hours on this (thinking I had somehow missed something). Incredible how they can miss something like that. But where did you find 7.0.4?
I got the "latest" SDK from https://github.com/liferay/liferay-mobile-sdk/releases and it still doesn't have 7.0.4 there?
I got the "latest" SDK from https://github.com/liferay/liferay-mobile-sdk/releases and it still doesn't have 7.0.4 there?
Richard Reyes:
Thank you. It is fixed in 7.0.4
Best
Daniel Wong, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 5 Beitrittsdatum: 19.04.16 Neueste Beiträge
Hi Jose
Thanks for pointing this out. But where do we obtain 7.0.4 from? https://github.com/liferay/liferay-mobile-sdk/releases only has 7.0.3 as the latest?
Daniel
Thanks for pointing this out. But where do we obtain 7.0.4 from? https://github.com/liferay/liferay-mobile-sdk/releases only has 7.0.3 as the latest?
Daniel
Jose M. Navarro, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Regular Member Beiträge: 138 Beitrittsdatum: 24.01.14 Neueste Beiträge
That version isn't a full version but just a tag. See the attachment
Daniel Wong, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 5 Beitrittsdatum: 19.04.16 Neueste Beiträge
Thanks Jose, managed to grab liferay-mobile-sdk-ios-7.0.4.zip
Oddly enough, though, the file LRSignIn.m in liferay-mobile-sdk-ios-7.0.4.zip is still missing the callback line. I added the line that Richard had proposed, and then it worked!
I know, we can try cocoapods (and I assume that 7.0.4 from cocoapods works), but I was thinking it may be advantageous to work with the source code to make modifications that we may desire, e.g., to set the user object in the signIn callback.
Anyway, just to let you know, LRSignIn.m in 7.0.4's source code is still missing the callback line.
thanks.
Oddly enough, though, the file LRSignIn.m in liferay-mobile-sdk-ios-7.0.4.zip is still missing the callback line. I added the line that Richard had proposed, and then it worked!
I know, we can try cocoapods (and I assume that 7.0.4 from cocoapods works), but I was thinking it may be advantageous to work with the source code to make modifications that we may desire, e.g., to set the user object in the signIn callback.
Anyway, just to let you know, LRSignIn.m in 7.0.4's source code is still missing the callback line.
thanks.
Bruno Farache, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Liferay Master Beiträge: 603 Beitrittsdatum: 14.05.07 Neueste Beiträge
It's published on Cocoapods as well.
Daniel Wong, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
New Member Beiträge: 5 Beitrittsdatum: 19.04.16 Neueste Beiträge
Thanks Bruno, good to know that. For this particular project, we may want to use the source code version, to customize some stuff, but for other projects, would be great to use cocoapods for that.
Bruno Farache, geändert vor 8 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Liferay Master Beiträge: 603 Beitrittsdatum: 14.05.07 Neueste Beiträge
Hi Daniel, you can use Cocoapods and still be able to change the source code.
In fact, if you need to change the Mobile SDK, it's better than using the zip file, because you can fork the project and ask Cocoapods to use that instead, which makes it easier to share changes with other devs.
Regarding the LRSignIn issue, I will take a look today.
In fact, if you need to change the Mobile SDK, it's better than using the zip file, because you can fork the project and ask Cocoapods to use that instead, which makes it easier to share changes with other devs.
Regarding the LRSignIn issue, I will take a look today.
Genar Codina, geändert vor 7 Jahren.
RE: 'Liferay-iOS-SDK', '~> 7.0' | LRSignin signInWithSession
Junior Member Beiträge: 28 Beitrittsdatum: 18.04.16 Neueste Beiträge
Hello,
It seems that the solution to add:
in the method "signInWithSession":
makes the "onSuccess" (from session) to be called; however, nobody has made any change in the original code in "signInWithSession"; at least I have not seen that change in version 7.0.4 -published on Mar 10; and even the release "liferay-mobile-sdk 2.0-beta-1"- published on Apr 29; does not include either that change.
Regards,
It seems that the solution to add:
[callback onSuccess:nil];
in the method "signInWithSession":
+ (void)signInWithSession:(LRSession *)session callback:(id<lrcallback>)callback
method:(LRSignInMethod)method error:(NSError **)error {
LRGroupService_v7 *service = [[LRGroupService_v7 alloc]
initWithSession:session];
[session
onSuccess:^(NSArray *groups) {
if ([groups count] == 0) {
*error = [LRError errorWithCode:LRErrorCodeUnauthorized
description:@"User doesn't belong to any site"];
return;
}
NSDictionary *site = [groups objectAtIndex:0];
long long companyId = [site[@"companyId"] longLongValue];
LRSession *userSession = [[LRSession alloc]
initWithSession:session];
[userSession setCallback:callback];
LRUserService_v7 *userService = [[LRUserService_v7 alloc]
initWithSession:userSession];
NSString *username = [self _getUsername:session];
if (method == LRSignInMethodEmail) {
[userService getUserByEmailAddressWithCompanyId:companyId
emailAddress:username error:error];
}
else if (method == LRSignInMethodUserID) {
long long userId = [username longLongValue];
[userService getUserByIdWithUserId:userId error:error];
}
else if (method == LRSignInMethodScreenName) {
[userService getUserByScreenNameWithCompanyId:companyId
screenName:username error:error];
}
[callback onSuccess:nil]; // Note: New added call so that "onSuccess" can be called.
}
onFailure:^(NSError *e) {
[callback onFailure:e];
}
];
[service getUserSitesGroups:error];
}</lrcallback>
makes the "onSuccess" (from session) to be called; however, nobody has made any change in the original code in "signInWithSession"; at least I have not seen that change in version 7.0.4 -published on Mar 10; and even the release "liferay-mobile-sdk 2.0-beta-1"- published on Apr 29; does not include either that change.
Regards,