【问题标题】:"errors encountered while discovering extensions" in Objective-CObjective-C 中的“发现扩展时遇到的错误”
【发布时间】:2018-01-02 18:46:55
【问题描述】:

我正在使用 UIImagePickerController 将用户选择的图像发送到 API,但出现此错误:

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}

这是发生错误的代码:

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];

该代码在此方法中:(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info。

这里有什么问题?

【问题讨论】:

    标签: ios objective-c uiimagepickercontroller


    【解决方案1】:

    对我有用的解决方案只是进入 Product(在屏幕顶部)-> Scheme -> EditScheme -> Arguments

    在环境变量中,添加值为“disable”的 OS_ACTIVITY_MODE

    希望这对其他人有用!

    我会附上屏幕截图以防我的描述令人困惑

    【讨论】:

    • 将 OS_ACTIVITY_MODE 设置为禁用,禁用日志语句,它实际上并没有修复任何问题。通过这样做,您还可以在控制台中隐藏其他可能重要的日志。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-18
    • 1970-01-01
    • 2017-08-10
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多