Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Unity WWW api调用在iOS设备中不起作用_C#_Unity3d - Fatal编程技术网

C# Unity WWW api调用在iOS设备中不起作用

C# Unity WWW api调用在iOS设备中不起作用,c#,unity3d,C#,Unity3d,我有一个api,它在某个事件中被调用。api可以在Web平台和编辑器上工作,但不能在iOS设备上工作。以下是我调用api的代码: 我也需要这个api在我的iOS设备上工作。在iOS设备上,当此代码运行时,它会打印日志语句“点击api的时间”,但它从不打印“立即获取响应”日志 请帮帮我,我做错了什么?你能用吗? 我用它,效果很好 见示例: // Create a form object for sending high score data to the server var form = new

我有一个api,它在某个事件中被调用。api可以在Web平台和编辑器上工作,但不能在iOS设备上工作。以下是我调用api的代码:

我也需要这个api在我的iOS设备上工作。在iOS设备上,当此代码运行时,它会打印日志语句“点击api的时间”,但它从不打印“立即获取响应”日志

请帮帮我,我做错了什么?

你能用吗?
我用它,效果很好

见示例:

// Create a form object for sending high score data to the server
var form = new WWWForm();
// Assuming the perl script manages high scores for different games
form.AddField( "game", "MyGameName" );
 // The name of the player submitting the scores
form.AddField( "playerName", playName );
 // The score
form.AddField( "score", score );

// Create a download object
var download = new WWW( someLink, form );

// Wait until the download is done
yield download;

if(download.error) {
    print( "Error downloading: " + download.error );
    return;
} else {
    // show the highscores
    Debug.Log(download.text);
}

通常情况下,答案应该不仅仅包括指向工具/库的链接。也许会解释为什么它能解决问题,以及如何使用它来解决问题problem@psubsee2003谢谢你的评论。我添加了示例代码。这在Android、Windows和Windows Mobile中都可以使用,但不幸的是,在iOS上不能使用。Unity上的iOS实现会被破坏吗?我们是否需要在XCode项目的某个地方设置某种特殊标志,以允许苹果设备在互联网上进行通信?
// Create a form object for sending high score data to the server
var form = new WWWForm();
// Assuming the perl script manages high scores for different games
form.AddField( "game", "MyGameName" );
 // The name of the player submitting the scores
form.AddField( "playerName", playName );
 // The score
form.AddField( "score", score );

// Create a download object
var download = new WWW( someLink, form );

// Wait until the download is done
yield download;

if(download.error) {
    print( "Error downloading: " + download.error );
    return;
} else {
    // show the highscores
    Debug.Log(download.text);
}