_reactNativeHealth.default.initHealthKit is not a function (it is undefined) error

I ran into the React Native HealthKit initialization error "_reactNativeHealth.default.initHealthKit is not a function (it is undefined)" and found it was caused by RN's new lazy-loading mechanism for modules, which leaves NativeModules as an empty object. I temporarily worked around it by manually grabbing the functions I needed and assigning them to the Kit object, so I could keep developing.

App Development

Unity Hub on Mac: installing a specific arm64 version

I can't install the version I need directly from the Hub. So I went to the official website Archive to find the version. The install URL is unityhub://2022.3.20f1/61c2feb0970d. The install that pops up this way is the Intel version — what do I do if I want the ARM version? Here's the answer from the official website:

App Development

Goal-based vector field pathfinding

A goal-based vector field pathfinding method that helps agents navigate efficiently by generating a heat map and a vector field. It walks through the algorithm's three steps: generating a heat map that describes distance along the path, creating a vector field pointing toward the goal, and using the vector field to steer agents' movement. How to solve the local optimum problem, and how subdividing the grid optimizes path computation to make pathfinding more stable and efficient.

App Development

DAZ imported into Unity, fixing the white eyes

DAZ imported into Unity, fixing the white eyes: in the FBX import settings - Materials, change Location to “use external materials” and Naming to “From Model’s Material”, then apply, and reconfigure it in the material, for the eyeball surface

App Development

Notes on dealing with Google Play's 64-bit requirement in an old cocos project

I've got an old project, and to solve the problem of Google requiring 64-bit support, I was getting ready to upgrade cocos a bit — then found out it wasn't necessary. Supposedly you just need to compile a 64-bit build. I vaguely remember deleting arm64-v8a back then. Google's guide: https://developer.android.com/distribute/best-practices/develop/64-bit#test\_your\_app\_on\_64-bit\_hardware describes three cases — building with Gradle, with CMake, with ndk-build — and they're all different. From my testing, cocos2dx turns out to be ndk-build mode, which depends on the PROP\_APP\_ABI setting in gradle.properties.

App Development

Multipart body must have at least one part

Using RN caused this error. After checking, the problematic code is: postJson(cmd, dataObj) { let url = Defines.SERVER_ADDR + cmd; let formData = new FormData(); ...

App Development

Using terrain in the Tiled map editor

Starting with Tiled 0.9.0, a new tool was added that makes it easier to edit terrain transitions in tile maps. There are many ways to handle terrain transitions between tiles in a tile map, but Tiled’s terrain tool supports transitions between tile graphics whose corners are all well-defined, which is also the most common approach. Now let’s demonstrate how to use this tool and the steps for setting up terrain information, by working through the desert.tmx that ships in the example directory of the Tiled installation package. Creating a new tile map and tileset Create a new map with a tile size of 32x32:

App Development

From AS to cocos2d-Action

I used to be an ActionScript developer. Last year I started working with Objective-C, and this year I got into cocos2d. I’ve had some insights during the learning process, so I’m looking back and sharing them, as a report and reference for more fellow developers who want to move from Flash development to cocos2d. Learning cocos2d has been a pleasant process, because switching from Starling feels incredibly convenient—like back when I moved from PureMVC to Robotlegs, that feeling of meeting too late. This article records a short summary of what I learned about Action in cocos2d. Actions in cocos2d are similar to motion tweens in Flash, but they’re more powerful. In Flash, everything you can do with motion tweens, including position, rotation, scale, color, and opacity, can also be done with Actions in Cocos2D. But in Flash development, relying only on changes in position, rotation, scale, color, and opacity isn’t enough to make an interesting game—these are just animations. More comprehensive actions are what make various values change, and they come in two types: instantaneous changes and changes over time. In Flash, I generally use GTween to control changes to various values. Here’s an example: say you’re making the resource amount display text in StarCraft. When you spend or gather some resources, the resource amount text doesn’t change directly; it ticks over time. So I usually create a custom TextField, implement a pair of getter and setter, and use GTween to change their values, adding easing. Many effects can be achieved this way. You can even ease through texture swaps according to certain rules.

App Development

Food Match-3 Launched

A single-player iPad game I developed in my spare time. My wife loves match-3 games, so I started with a match-3, and since food is adorable, I went with a food theme. Development plus assembling ...

App Development

ANE for opening the native Maps app and navigating on iOS 6

cn.flashj.ane.ios.OpenMap is a native extension for iOS that does one very simple thing: jump to the system’s built-in Maps app and navigate to a place. It provides 2 methods: openMap.routeFromSourceToDest(source, dest); navigates from source to dest. openMap.routeToDest(dest); navigates from the current location to dest. The source and dest parameters are both cn.flashj.ane.ios.MapItemVO, a class with three fields: latitude, longitude, and place name. Example usage:

Flash
12