2012-01-07 182 views
0

我使用GraphAPI_Mobile_1_8_1.swc通過在Flex 4.6中製作的移動應用程序在Facebook中發送照片,但發佈時發生錯誤,但我無法識別,有人可以幫助我嗎? 下來的,我怎麼做的代碼....錯誤發佈照片facebook

<? xml version = "1.0" encoding = "utf-8"?> 
<s: View xmlns: fx = "http://ns.adobe.com/mxml/2009" 
xmlns: s = "library:// ns.adobe.com/flex/spark" title = "PostPhotos" 
creationComplete = "init (event)"> 
<fx:Declarations> 
<! - Place non-visual elements (eg, services, value objects) here -> 
</ fx: Declarations> 

<fx:Script> 
<! [CDATA [ 
com.facebook.graph.FacebookMobile import; 

mx.events.FlexEvent import; 
mx.rpc.events.ResultEvent import; 

public var permissions: Array = ["user_photos", "user_birthday", "read_stream", "publish_stream"]; 

public function init (event: FlexEvent): void { 
FacebookMobile.init ("my id" OnLogin); 
} 


protected function postPhoto(): void { 
var values: Object = {message: 'mobiFace' fileName 'FILE_NAME', image: imgUser}; 
FacebookMobile.api ('/ me/photos', handlePhoto, values​​, 'POST'); 
} 


protected function handlePhoto(response: Object, fail: Object): void { 
imgUser.source = null; 
lblStatus.Text = (response)? 'Photograph posted successfully', 'Error in posting'; 
} 


]]> 
</ fx: Script> 
<s:Image id="imgUser" x="10" y="10" width="157" height="117" source="image/facebook (6).png"/> 

<s:Label id="lblStatus" x="9" y="219" /> 
<s:Button x="10" y="147" width="157" label="Post photo" click="{postPhoto()}"/> 
</ s: View> 

我揹着張貼任何圖像在圖像... 錯誤張貼,但回報率作爲一個函數handlePhoto ......我不知道爲什麼....

+0

是什麼在你'fail'對象? – 2012-01-07 19:59:18

+0

失敗是返回對象,但顯然代碼是正確的,所以我不知道爲什麼不發佈 – 2012-01-07 21:25:38

+0

你可以發佈JSON序列化'失敗'對象?它可能包含您收到的真實錯誤... – 2012-01-08 06:32:00

回答

0

我轉換爲位圖數據imgUser直接....

protected function postPhoto(): void { 
    var values: Object = {message: '+ Flex Mobile Post', image: imgUser.bitmapData}; 
    FacebookMobile.api ("/ me/photos", handlePhotovalues​​, "POST"); 
} 
相關問題