我已实现以下代码并出现以下错误。我无法解决我的问题:
06-12 12:05:41.580: E/Resources(6549): ExecutionException
06-12 12:05:41.580: E/Resources(6549): java.util.concurrent.ExecutionException: android.content.res.Resources$NotFoundException: File from drawable resource ID #0x7f020947
06-12 12:05:41.580: E/Resources(6549): at java.util.concurrent.FutureTask.report(FutureTask.java:93)
06-12 12:05:41.580: E/Resources(6549): at java.util.concurrent.FutureTask.get(FutureTask.java:163)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources.clearRCCachedDrawableLocked(Resources.java:3023)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources.mClearALDCLocked(Resources.java:3007)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources.updateConfiguration(Resources.java:2985)
06-12 12:05:41.580: E/Resources(6549): at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:494)
06-12 12:05:41.580: E/Resources(6549): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:4784)
06-12 12:05:41.580: E/Resources(6549): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:4737)
06-12 12:05:41.580: E/Resources(6549): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1585)
06-12 12:05:41.580: E/Resources(6549): at android.os.Handler.dispatchMessage(Handler.java:102)
06-12 12:05:41.580: E/Resources(6549): at android.os.Looper.loop(Looper.java:145)
06-12 12:05:41.580: E/Resources(6549): at android.app.ActivityThread.main(ActivityThread.java:6141)
06-12 12:05:41.580: E/Resources(6549): at java.lang.reflect.Method.invoke(Native Method)
06-12 12:05:41.580: E/Resources(6549): at java.lang.reflect.Method.invoke(Method.java:372)
06-12 12:05:41.580: E/Resources(6549): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
06-12 12:05:41.580: E/Resources(6549): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
06-12 12:05:41.580: E/Resources(6549): Caused by: android.content.res.Resources$NotFoundException: File from drawable resource ID #0x7f020947
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources$RCCallable.call(Resources.java:1186)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources$RCCallable.call(Resources.java:1160)
06-12 12:05:41.580: E/Resources(6549): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-12 12:05:41.580: E/Resources(6549): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-12 12:05:41.580: E/Resources(6549): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-12 12:05:41.580: E/Resources(6549): at java.lang.Thread.run(Thread.java:818)
06-12 12:05:41.580: E/Resources(6549): Caused by: java.io.FileNotFoundException:
06-12 12:05:41.580: E/Resources(6549): at android.content.res.AssetManager.openNonAssetNative(Native Method)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.AssetManager.openNonAsset(AssetManager.java:422)
06-12 12:05:41.580: E/Resources(6549): at android.content.res.Resources$RCCallable.call(Resources.java:1179)
06-12 12:05:41.580: E/Resources(6549): ... 5 more
错误:
[manager.requestSerializer setValue:@"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
答案 0 :(得分:1)
您必须在responseSerializer中添加application / soap + xml作为可接受的内容类型。
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/soap+xml", @"application/json", nil];
e.g。
QWidget
答案 1 :(得分:0)
您可以找到更详细的答案here。
我提取了这个有趣的部分:
“请求失败:不可接受的内容类型:application / soap + xml”错误由生成
- (BOOL)validateResponse:(NSHTTPURLResponse *)response
data:(NSData *)data
error:(NSError * __autoreleasing *)error
AFHTTPResponseSerializer的方法,以防止出现无法接受的MIME类型的响应。
您可以使用以下代码
进行修复self.responseSerializer = [AFXMLParserResponseSerializer serializer];
NSSet *set = self.responseSerializer.acceptableContentTypes;
self.responseSerializer.acceptableContentTypes = [set setByAddingObject:@"application/soap+xml"];
或修改AFXMLDocumentResponseSerializer - 将“application / soap + xml”添加到可接受的内容类型中:
- (instancetype)init {
self = [super init];
if (!self) {
return nil;
}
self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", @"application/soap+xml", nil];
return self;