我在 GTMHTTPUploadFetcher.m 文件中收到一条警告,提示找不到“-fetcherWithRequest:fetcherClass”(返回类型默认为“id”)
对于此代码
+ (GTMHTTPUploadFetcher *)uploadFetcherWithRequest:(NSURLRequest *)request
fetcherService:(GTMHTTPFetcherService *)fetcherService {
// Internal utility method for instantiating fetchers
GTMHTTPUploadFetcher *fetcher;
if (fetcherService) {
fetcher = [fetcherService fetcherWithRequest:request
fetcherClass:self];
} else {
fetcher = (GTMHTTPUploadFetcher *) [self fetcherWithRequest:request];
}
return fetcher;
}
然后我收到一个涉及基础框架的错误
解析问题预期表达式
//这是预期表达式所在的位置
- (void)uploadNextChunkWithOffset:(NSUInteger)offset
fetcherProperties:(NSMutableDictionary *)props {
// upload another chunk
NSUInteger chunkSize = [self chunkSize];
NSString *rangeStr, *lengthStr;
NSData *chunkData;
NSUInteger dataLen = [self fullUploadLength];
if (offset == kQueryServerForOffset) {
// resuming, so we'll initially send an empty data block and wait for the
// server to tell us where the current offset really is
chunkData = [NSData data];
rangeStr = [NSString stringWithFormat:@"bytes */%lu", (unsigned long)dataLen];
lengthStr = @"0";
offset = 0;
} else {
// uploading the next data chunk
#if DEBUG
**//this is the exact line of code causing the problem//**
(unsigned long)NSAssert2(offset < dataLen, @"offset %lu exceeds data length %lu",
offset, dataLen);
#endif
NSUInteger thisChunkSize = chunkSize;
// if the chunk size is bigger than the remaining data, or else
// it's close enough in size to the remaining data that we'd rather
// avoid having a whole extra http fetch for the leftover bit, then make
// this chunk size exactly match the remaining data size
BOOL isChunkTooBig = (thisChunkSize + offset > dataLen);
BOOL isChunkAlmostBigEnough = (dataLen - offset < thisChunkSize + 2500);
if (isChunkTooBig || isChunkAlmostBigEnough) {
thisChunkSize = dataLen - offset;
}
chunkData = [self uploadSubdataWithOffset:offset
length:thisChunkSize];
rangeStr = [NSString stringWithFormat:@"bytes %lu-%u/%lu",
(unsigned long)offset, offset + thisChunkSize - 1, (unsigned long)dataLen];
lengthStr = [NSString stringWithFormat:@"%lu", (unsigned long)thisChunkSize];
}
//related to this
! expanded from macro 'NSAssert2'
#define NSAssert2(condition, desc, arg1, arg2) NSAssert((condition), (desc), (arg1), (arg2))
! expanded from macro 'NSAssert'
#if !defined(_NSAssertBody)
#define NSAssert(condition, desc, ...) \
do { \
__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
if (!(condition)) { \
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
object:self file:[NSString stringWithUTF8String:__FILE__] \
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
} \
__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
} while(0)
#endif
更新 Xcode 后才开始出现错误(不是更新到新版本)
任何人有任何建议不确定这两者是否相关,因此将单独发布第二部分。
通过进入时间机器并恢复旧的 .m 文件并替换它来解决这个问题。它不会给我一个错误,但是由于 MIME 类型问题我无法上传视频,但那是另一篇文章。