大家好,我正在尝试使用AppMancer AMDownload将一些数据发布到php脚本中
这是我的代码

#include <MAUtil/Moblet.h>
#include <conprint.h>
#include <AMDownload/DownloadManager.h>

using namespace AMDownload;
using namespace MAUtil;

/**
* A Moblet is a high-level class that defines the
* behaviour of a MoSync program.
*/
class MyMoblet : public Moblet, private DownloadRequestListener
{
public:
/**
 * Initialize the application in the constructor.
 */
MyMoblet()
{
    printf("Press zero or back to exit\n");
}

/**
 * Called when a key is pressed.
 */
void keyPressEvent(int keyCode, int nativeCode)
{
    if (MAK_BACK == keyCode || MAK_0 == keyCode)
    {
        // Call close to exit the application.
        close();
    }

    // Print the key character.
    printf("You typed: %c\n", keyCode);
    String password = "p45sw0rd";
    DownloadRequest* req =  DownloadManager::createRequest(this);
    req->setUrl("https://acrscore.usa.cc/accounts/test/upload.php");
    req->setHttpMethod(HTTP_POST);
    req->addPostData("name", "hy");
    DownloadManager::enqueue(req);
}

 void downloadFinished(DownloadRequest* request){}

/**
 * Called when a key is released.
 */
void keyReleaseEvent(int keyCode, int nativeCode)
{
}

/**
 * Called when the screen is touched.
 */
void pointerPressEvent(MAPoint2d point)
{
    // Print the x and y coordinate.
    printf("You touched: %i %i\n", point.x, point.y);
}

private:

};

/**
 * Entry point of the program. The MAMain function
 * needs to be declared as extern "C".
 */
extern "C" int MAMain()
{
Moblet::run(new MyMoblet());
return 0;
}


这是控制台输出

[28] Emulator connected.
[28] PrintConsole:
[28] Press zero or back to exit
[28]
[28] PrintConsole:
[28] You typed: 4
[28] MoSync Panic 40055. "Attempted to use a resource, but no resources exist." The     panic occurred in the syscall maGetDataSize.
[28] IP:0xefda: crtlib.s:1
[28] IP:0x2b0: C:/MoSync/workspace/uu/main.cpp:20
[28] IP:0x2058e: c:/slave/buildScripts/temp_Nnqh/source/libs/MAUtil/Moblet.cpp:89
[28] IP:0x1a704: c:/slave/buildScripts/temp_Nnqh/source/libs/MAUtil/ListenerSet.h:60
[28] IP:0x13f: C:/MoSync/workspace/uu/main.cpp:13
[28] IP:0x1c7: C:/MoSync/workspace/uu/main.cpp:41
[28] IP:0x696a0: C:/MoSync/AppMancer/AMDownload/DownloadManager.cpp:81
[28] IP:0x6952a: C:/MoSync/AppMancer/AMDownload/DownloadManager.cpp:195
[28] IP:0x67ce0: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:68
[28] IP:0x67a75: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:269
[28] Exit @ IP 0x67a73  SP 0x3ffe9c
[28] IP:0x67a73: C:/MoSync/AppMancer/AMDownload/HttpDownloader.cpp:269


我不明白我的意思

MoSync Panic 40055. "Attempted to use a resource, but no resources exist." The panic occurred in the syscall maGetDataSize.


我已经设置了发布数据req-> addPostData(“ name”,“ hy”);

有人可以帮我吗?

最佳答案

在MoDownload 3.0.1的AMDownload的第一版中有一个错误-对此感到抱歉。有一个正确的版本可以从http://appmancer.com/download/AMDownload.zip下载。将两个文件解压缩到MoSync / lib / pipe文件夹中。

09-07 04:19