gpt4 book ai didi

ios - Objective-C中的“发现扩展时遇到的错误”

转载 作者:行者123 更新时间:2023-12-01 19:46:50 25 4
gpt4 key购买 nike

我正在使用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

这是什么问题?

最佳答案

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

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

希望这对其他人有用!

我将附上屏幕截图,以防我的描述令人困惑enter image description here

关于ios - Objective-C中的“发现扩展时遇到的错误”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48066180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com