Search code examples
instancensassert

fetcherWithRequest:fetcherClass not found


I am getting a warning in my GTMHTTPUploadFetcher.m file that says "-fetcherWithRequest:fetcherClass" not found (return type defaults to "id")

for this code

+ (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;
}

and then I get an error involving the Foundation Framework

Parse Issue expected expression

//this is where the expected expression is

- (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

Only started getting the error after I updated Xcode (not to new version just update)

anyone have any suggestions not sure these two are related or not so will post this second part separately.

Solved this by going into time machine and resurrecting the old .m file and replacing it. It no doesn't give me an error, however I can't upload video because of MIME type problem, but that's another post.


Solution

  • Solved this by going into time machine and resurrecting the old .m file and replacing it.