2012-01-07 185 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"); 
} 
相关问题