Skip to content

Objective-C functions returning unsigned char * are not correctly interpreted in {N} #1196

@tbozhikov

Description

@tbozhikov

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.0.3
  • iOS Runtime: 6.0.0

Describe the bug
Using the following iOS API from {N}:

extern unsigned char *
CC_SHA256(const void *data, CC_LONG len, unsigned char *md);

returns a result that is interpreted as buffer of signed ints, which ends up working with wrong results.

To Reproduce
See this {N} Playground. The following line is the workaround that rescues the situation:

let buffer = new interop.Reference(interop.types.uint8, sha256buffer);

Without it, the result from CC_SHA256 is treated as signed integers and that can lead to wrong results.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions