fi12
fi12

Reputation: 485

"errors encountered while discovering extensions" in Objective-C

I'm using a UIImagePickerController to send a user-selected image to an API, but am getting this error:

warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available. [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

This is the code in which the error occurs:

NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
    [body appendFormat:@"--%@\r\n", boundary];
    if (param[@"fileName"]) {
        [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
        [body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
        [body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSMacOSRomanStringEncoding/*NSUTF8StringEncoding*/ error:&error]];
        if (error) {
            NSLog(@"%@", error);
        }
    } else {
        [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
        [body appendFormat:@"%@", param[@"value"]];
    }
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];

That code is inside this method: (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info.

What is the issue here?

Upvotes: 1

Views: 1139

Answers (1)

danner.tech
danner.tech

Reputation: 109

The solution that worked for me was simply going into Product (at the top of the screen) -> Scheme -> EditScheme -> Arguments

In Environment Variables, add OS_ACTIVITY_MODE with a value of "disable"

Hopefully this works for someone else!

I'll attach a screenshot just in case my description seemed confusingenter image description here

Upvotes: 2

Related Questions