/ 开发笔记

#Facebook Instant Game# 尝试打开外部URL,毫不意外地失败了。

想在Facebook Instant Game中直接打开别的页面,毫不意外地失败了。

        let url = "https://fb.gg/play/stackystackbymokomo";
        cc.sys.openURL(url);

错误如下:
Snip20190322_16

如果想要跳转到别的小游戏(交叉推广),需要使用API switchGameAsync

switchGameAsync( )
Request that the client switch to a different Instant Game. The API will reject if the switch fails - else, the client will load the new game.

Parameters

appID string
 The Application ID of the Instant Game to switch to. The application must be an Instant Game, and must belong to the same business as the current game. To associate different games with the same business, you can use Business Manager: https://developers.facebook.com/docs/apps/business-manager#update-business.
 
data Object
? An optional data payload. This will be set as the entrypoint data for the game being switched to. Must be less than or equal to 1000 characters when stringified.

Examples

FBInstant.switchGameAsync('12345678').catch(function (e) {
  // Handle game change failure
});

Throws USER_INPUT
Throws INVALID_PARAM
Throws PENDING_REQUEST
Throws CLIENT_REQUIRES_UPDATE

Returns Promise