Fórumok
iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
Riccardo Masini, módosítva 10 év-val korábban
iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.05.14. Legújabb bejegyzések
Hi,
I'm trying to develop my first app using Liferay Mobile SDK.
I was trying to retrieve Vocabularies and Categories.
I managed to retrieve Vocabularies with this code:
Then, with the vocabulary id, I'm trying to get the Categories for each vocabulary using the method:
But I don't know what to pass at the 'obc' parameter. I've tried with NULL but the app crashes, I've tried with @"asc", @{@"orderByType":@"asc"}, but I always get an error from liferay:
Problem while instantiating class com.liferay.portal.kernel.util.OrderByComparator
Can someone help me on how to use the obc parameter?
Thanks
I'm trying to develop my first app using Liferay Mobile SDK.
I was trying to retrieve Vocabularies and Categories.
I managed to retrieve Vocabularies with this code:
LRAssetVocabularyService_v62 *servizioVocabulary = [[LRAssetVocabularyService_v62 alloc] initWithSession:session];
NSArray *arrayVocabulary = [servizioVocabulary getCompanyVocabulariesWithCompanyId:10157 error:&error];
Then, with the vocabulary id, I'm trying to get the Categories for each vocabulary using the method:
LRAssetCategoryService_v62 *servizioCategory = [[LRAssetCategoryService_v62 alloc] initWithSession:session];
...
int vocabularyId = (int)[[arrayVocabulary objectAtIndex:i]valueForKey:@"vocabularyId"];
[servizioCategory getVocabularyRootCategoriesWithVocabularyId:vocabularyId start:-1 end:-1 obc:??? error:&error];
But I don't know what to pass at the 'obc' parameter. I've tried with NULL but the app crashes, I've tried with @"asc", @{@"orderByType":@"asc"}, but I always get an error from liferay:
Problem while instantiating class com.liferay.portal.kernel.util.OrderByComparator
Can someone help me on how to use the obc parameter?
Thanks
Juan Fernández, módosítva 10 év-val korábban
RE: iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
Liferay Legend Bejegyzések: 1261 Csatlakozás dátuma: 2008.10.02. Legújabb bejegyzések
Riccardo Masini, módosítva 9 év-val korábban
RE: iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.05.14. Legújabb bejegyzések
Doesn't work
I'm trying doing this:
But I get this error:
Error Domain=com.liferay.mobile.sync.ErrorDomain Code=-1 "Missing value at character 6"
I saw in the json ws of my Liferay instance ( http://localhost:8080/api/jsonws ) that the type of this parameter is com.liferay.portal.kernel.util.OrderByComparator but the iOS api asks for a NSDictionary...I really can't figure out what I have to pass as parameter...
I'm trying doing this:
[categorySerivce getVocabularyRootCategoriesWithVocabularyId:vocabularyId start:-1 end:-1 obc:@{@"-obc":@""} error:&error];
But I get this error:
Error Domain=com.liferay.mobile.sync.ErrorDomain Code=-1 "Missing value at character 6"
I saw in the json ws of my Liferay instance ( http://localhost:8080/api/jsonws ) that the type of this parameter is com.liferay.portal.kernel.util.OrderByComparator but the iOS api asks for a NSDictionary...I really can't figure out what I have to pass as parameter...
Bruno Farache, módosítva 9 év-val korábban
RE: iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
Liferay Master Bejegyzések: 603 Csatlakozás dátuma: 2007.05.14. Legújabb bejegyzések
Hi Riccardo,
I will take a look into this issue. I created a ticket for that: MOBILESDK-15, you can receive updates about it by clicking on "watch" in the ticket.
I will take a look into this issue. I created a ticket for that: MOBILESDK-15, you can receive updates about it by clicking on "watch" in the ticket.
Riccardo Masini, módosítva 9 év-val korábban
RE: iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.05.14. Legújabb bejegyzések
FYI
I've managed to get the method working by modifying this code in LRAssetCategoryService_v62.m, from:
to:
So, as suggested by the link in Juan Fernández's answer, the parameter obc is taken by Liferay as null.
The method also gives the result by modifying the method like this:
I've managed to get the method working by modifying this code in LRAssetCategoryService_v62.m, from:
- (NSArray *)getVocabularyRootCategoriesWithVocabularyId:(long long)vocabularyId start:(int)start end:(int)end obc:(NSDictionary *)obc error:(NSError **)error {
NSDictionary *_params = @{
@"vocabularyId": @(vocabularyId),
@"start": @(start),
@"end": @(end),
@"obc": obc
};
NSDictionary *_command = @{@"/assetcategory/get-vocabulary-root-categories": _params};
return (NSArray *)[self.session invoke:_command error:error];
}
to:
- (NSArray *)getVocabularyRootCategoriesWithVocabularyId:(long long)vocabularyId start:(int)start end:(int)end obc:(NSDictionary *)obc error:(NSError **)error {
NSDictionary *_params = @{
@"vocabularyId": @(vocabularyId),
@"start": @(start),
@"end": @(end),
@"-obc": obc
};
NSDictionary *_command = @{@"/assetcategory/get-vocabulary-root-categories": _params};
return (NSArray *)[self.session invoke:_command error:error];
}
So, as suggested by the link in Juan Fernández's answer, the parameter obc is taken by Liferay as null.
The method also gives the result by modifying the method like this:
- (NSArray *)getVocabularyRootCategoriesWithVocabularyId:(long long)vocabularyId start:(int)start end:(int)end obc:(NSDictionary *)obc error:(NSError **)error {
NSDictionary *_params = @{
@"vocabularyId": @(vocabularyId),
@"start": @(start),
@"end": @(end),
@"+obc": @"com.liferay.portlet.journal.util.comparator.ArticleCreateDateComparator"
};
NSDictionary *_command = @{@"/assetcategory/get-vocabulary-root-categories": _params};
return (NSArray *)[self.session invoke:_command error:error];
}
Bruno Farache, módosítva 9 év-val korábban
RE: iOS mobile SDK, problem with OBC while retreiving Vocabulary categories
Liferay Master Bejegyzések: 603 Csatlakozás dátuma: 2007.05.14. Legújabb bejegyzések
Thanks for sharing, Riccardo. We are fixing it right now, see last commits:
https://github.com/brunofarache/liferay-mobile-sdk/commits/master
Fixed for Android and now working on iOS.
If you want to pass the comparator, you can do:
"+obc": "com.liferay.OrderByComparatorImplementation"
https://github.com/brunofarache/liferay-mobile-sdk/commits/master
Fixed for Android and now working on iOS.
If you want to pass the comparator, you can do:
"+obc": "com.liferay.OrderByComparatorImplementation"
Bruno Farache, módosítva 9 év-val korábban