Problem with UIImageWriteToSavedPhotosAlbum
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- ios, typescript
- 领域
- mobile-dev
调研方向
首先使用 @nativescript/ios 7.2.0 复现 image-util.ios.ts 中 saveToAlbum 的 assertion,然后将相同的 UIImageWriteToSavedPhotosAlbum completionTarget 代码与 6.5.4 版本进行比较。当 completion callback 在较新版本中无需 ClassBuilder assertion 即可工作时,该 issue 就解决了。
由索引模型根据 Issue 内容生成。
描述
Hey there I encountered a problem when calling UIImageWriteToSavedPhotosAlbum with a completionTarget. This error does not appear if I use "@nativescript/ios": "6.5.4", instead of "@nativescript/ios": "7.2.0".
I also tried to use the Typescript Subclassing Syntax without any success.
Error:
====== Assertion failed ======
Native stack trace:
1 0x10f628630 tns::Assert(bool, v8::Isolate*) + 119
2 0x10f620d3d tns::ClassBuilder::GetTypeEncodingType(v8::Isolate*, v8::Local<v8::Value>) + 121
3 0x10f61eda7 tns::ClassBuilder::ExposeDynamicMethods(v8::Local<v8::Context>, objc_class*, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::Local<v8::Object>) + 1069
4 0x10f61e93f tns::ClassBuilder::ExposeDynamicMembers(v8::Local<v8::Context>, objc_class*, v8::Local<v8::Object>, v8::Local<v8::Object>) + 219
5 0x10f61def5 tns::ClassBuilder::ExtendCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 459
6 0x10f75fd2c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) + 620
7 0x10f75f1dc v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 556
8 0x10f75e863 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 259
9 0x10fff7819 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
10 0x10ff90842 Builtins_InterpreterEntryTrampoline + 194
JavaScript stack trace:
at saveToAlbum (file: .../image-util.ios.ts:10:46)
Code Snippet:
This implementation is based on this post.
const CompletionTarget = (<any> NSObject).extend({
'thisImage:hasBeenSavedInPhotoAlbumWithError:usingContextInfo:': function (image, error, context) {
if (error) {
console.log("on error", error);
}
}
}, {
exposedMethods: {
'thisImage:hasBeenSavedInPhotoAlbumWithError:usingContextInfo:': {
returns: interop.types.void,
params: [UIImage, NSError, interop.Pointer]
}
}
});
const completionTarget = CompletionTarget.alloc().init();
UIImageWriteToSavedPhotosAlbum(imageSource.ios, completionTarget,'thisImage:hasBeenSavedInPhotoAlbumWithError:usingContextInfo:',null);
Calling UIImageWriteToSavedPhotosAlbum without a completionTarget works fine.
UIImageWriteToSavedPhotosAlbum(imageSource.ios, null, null, null);
Setup:
"dependencies": {
"@angular/animations": "~11.2.7",
"@angular/common": "~11.2.7",
"@angular/compiler": "~11.2.7",
"@angular/core": "~11.2.7",
"@angular/forms": "~11.2.7",
"@angular/platform-browser": "~11.2.7",
"@angular/platform-browser-dynamic": "~11.2.7",
"@angular/router": "~11.2.7",
"@nativescript/angular": "~10.0.0",
"@nativescript/core": "7.3.0",
"@nativescript/unit-test-runner": "^1.0.2",
"core-js": "3.9.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.5.5",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1102.6",
"@angular/cli": "~11.2.6",
"@angular/compiler-cli": "~11.2.7",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.2.0",
"@nativescript/types": "7.3.0",
"@nativescript/webpack": "~3.0.0",
"@ngtools/webpack": "~10.0.0",
"@types/jasmine": "~3.6.0",
"codelyzer": "^6.0.0",
"karma": "6.3.1",
"karma-jasmine": "~4.0.0",
"karma-nativescript-launcher": "0.4.0",
"karma-webpack": "3.0.5",
"node-sass": "^4.7.1",
"tslint": "~6.1.3",
"typescript": "4.1.5"
}
- 主要语言
- JavaScript
- 星标
- 150
- 派生
- 43
- 平均合并
- 3 天 10 小时
- 30 天内合并 PR
- 22
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NativeScript/ios 的其他 Issue
-
难度 5/5 一周以上 新手友好度 38/100
NativeScript/ios#459 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
NativeScript/ios#445 ·
-
难度 3/5 3-5 天 新手友好度 66/100
NativeScript/ios#414 ·
-
question
难度 4/5 3-5 天 新手友好度 34/100
NativeScript/ios#364 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
NativeScript/ios#355 ·
相似的 Issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
georgestephanis/p2026#40 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·