0
我正在使用RestKit,我正在嘗試使用RKPaginator。但是,我需要在URL請求中包含日期時間字段。我建立以下requestString,這是一個的NSString,並在使用它:RKPaginator URL中的日期時間字段
RKPaginator *paginator = [objectManager paginatorWithPathPattern:requestString];
requestString is @「/api/rest/equipment/?count=3&limit=:perPage&offset=:offset&last_modified_date__gte=2014-03-31T17:20:26
不過,我不斷收到:
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Parameters must be separated by non-parameter characters.'
這是由於「:」在日期時間。所以......
我嘗試:
@「/api/rest/equipment/?count=3&limit=:perPage&offset=:offset&last_modified_date__gte=2014-03-31T17\\:20\\:26
不過,我不斷收到RestKit內bad_access當我這樣做,在下面的功能:
NSString *RKPathAndQueryStringFromURLRelativeToURL(NSURL *URL, NSURL *baseURL)
{
if (baseURL) {
if (! RKURLIsRelativeToURL(URL, baseURL)) return nil;
return [[URL absoluteString] substringFromIndex:[[baseURL absoluteString] length]];
} else {
// NOTE: [URL relativeString] would return the same value as `absoluteString` if URL is not relative to a baseURL
NSString *query = [URL query];
NSString *pathWithPrevervedTrailingSlash = [CFBridgingRelease(CFURLCopyPath((CFURLRef)URL)) stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return (query && [query length]) ? [NSString stringWithFormat:@"%@?%@", pathWithPrevervedTrailingSlash, query] : pathWithPrevervedTrailingSlash;
}
}
我遵循這個建議:https://github.com/RestKit/RestKit/issues/1745我現在將使用我自己的修復程序,並且我將等待那個拉來下一個版本;) – abisson