weidian-inc / hera

A framework for running WeChat applet. (小程序 SDK,小程序转 H5,小程序转安卓、iOS 原生应用、小程序渲染引擎)
https://weidian-inc.github.io/hera
Other
1.48k stars 315 forks source link

iOS 下获取 getImageInfo 失败 #14

Closed scplwq closed 6 years ago

scplwq commented 6 years ago

在 WHE_getImageInfo.m 中

...
NSString *fileName = fileURL.lastPathComponent;
...

如果fileURL的格式是: wdfile://tmp_123456789.jpg, 则 fileURL.lastPathComponet 为 nil, tmp_123456789.jpg 被识别为了host。导致image取不到。

如果给url加一个斜杠,如 wdfile://tmp_123456789.jpg => wdfile:///tmp_123456789.jpg 代码逻辑就没问题了,可以获取正常。但是 image 控件识别不了这个url,不能显示出来了。

scplwq commented 6 years ago

or if ([self.src hasPrefix:@"wdfile://tmp_"]) { fileName = [[self.src componentsSeparatedByString:@"//"] lastObject]; }

wwwyiqiao commented 6 years ago

ok 已经修复了