2012-05-12 58 views
0

大家好我試着使用AppMancer AMDownload 這裏是我的代碼mosyn HTTP POST使用AMDownload

#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; 
} 

這張貼一些數據的PHP腳本的控制檯輸出

[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 

我到PHP不明白我的即時通訊

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

我已經設置了發佈數據req-> addPostD ata(「name」,「hy」);

是否有人可以幫助我?

回答

1

在MoSync 3.0.1的首次發佈的AMDownload中存在一個錯誤 - 很抱歉。有從http://appmancer.com/download/AMDownload.zip下載的正確版本。將這兩個文件解壓縮到MoSync/lib/pipe文件夾中。

+0

感謝您的幫助。 – acrs