You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When integrating the Spotify SDK into {N}, there were fields which were inaccessible from JavaScript. E.g. @property (nullable, nonatomic, strong, readonly) id<SPTAppRemotePlayerAPI> playerAPI; turned out to be returning a variable from an internal class which had no metadata in {N}. As a result
prints appRemote.playerAPI: <SPTAppRemotePlayerAPIImplemenation: 0x28062a840>
Describe the solution you'd like
It would be convenient if such internal classes' members coming from protocols (with generated metadata) could be accessible from JS out of the box, regardless of the fact that there's no metadata for the classes themselves.
Describe alternatives you've considered
As a workaround with the current state of the runtime, it's possible to manually write code which will generate metadata for the types. One drawback of this approach is that it hardcodes the name of the internal class which might change with newer releases of the same library. In the above case, if one adds:
in nativescript-spotify/platforms/ios/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h after the declaration of the SPTAppRemotePlayerAPI protocol or (even better) in a new header included in the umbrella header of the plugin, this code:
CONSOLE LOG file:///app/bundle.js:10168:28: appRemote.playerAPI.subscribeToPlayerState: function subscribeToPlayerState() {
[native code]
}
CONSOLE LOG file:///app/bundle.js:10169:28: appRemote.playerAPI.seekToPosition: function seekToPositionCallback() {
[native code]
}
Additional context
Another workaround that doesn't hardcode the class name is to use dynamic invocation, but it would be even more inconvenient to write and support.
The text was updated successfully, but these errors were encountered:
Description
When integrating the Spotify SDK into {N}, there were fields which were inaccessible from JavaScript. E.g.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemotePlayerAPI> playerAPI;
turned out to be returning a variable from an internal class which had no metadata in {N}. As a resultprints
undefined
. Whileprints
appRemote.playerAPI: <SPTAppRemotePlayerAPIImplemenation: 0x28062a840>
Describe the solution you'd like
It would be convenient if such internal classes' members coming from protocols (with generated metadata) could be accessible from JS out of the box, regardless of the fact that there's no metadata for the classes themselves.
Describe alternatives you've considered
As a workaround with the current state of the runtime, it's possible to manually write code which will generate metadata for the types. One drawback of this approach is that it hardcodes the name of the internal class which might change with newer releases of the same library. In the above case, if one adds:
in
nativescript-spotify/platforms/ios/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h
after the declaration of theSPTAppRemotePlayerAPI
protocol or (even better) in a new header included in the umbrella header of the plugin, this code:will correctly output:
Additional context
Another workaround that doesn't hardcode the class name is to use dynamic invocation, but it would be even more inconvenient to write and support.
The text was updated successfully, but these errors were encountered: