Results 1 to 2 of 2

Thread: Error in retrieving data from facebook to qt gui application

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    33
    Qt products
    Qt4
    Platforms
    Windows

    Default Error in retrieving data from facebook to qt gui application

    hai,

    This is the code for gui application to connect FB.Using this ap we can retrieve the names of our friends.


    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. #include <QtGlobal>
    5. #include <QDebug>
    6. #include <QMessageBox>
    7.  
    8. #include "fbrequest.h"
    9. #include "fberror.h"
    10.  
    11. static QString UserId;
    12.  
    13. MainWindow::MainWindow(QWidget *parent) :
    14. QMainWindow(parent),
    15. ui(new Ui::MainWindow),
    16. iLoginDialog ( NULL )
    17. {
    18. ui->setupUi(this);
    19.  
    20. iFBSession = FBSession::sessionForApplication("xxxxxxxxxxx","xxxxxxxxxxx", QString());
    21. connect (iFBSession,SIGNAL(sessionDidLogin(FBUID)), this, SLOT(sessionDidLogin(FBUID)));
    22. connect (iFBSession, SIGNAL(sessionDidLogout()), this, SLOT(sessionDidLogout()));
    23. }
    24.  
    25. MainWindow::~MainWindow()
    26. {
    27. delete iFBSession;
    28. delete ui;
    29. }
    30.  
    31. void MainWindow::changeEvent(QEvent *e)
    32. {
    33. QMainWindow::changeEvent(e);
    34. switch (e->type()) {
    35. case QEvent::LanguageChange:
    36. ui->retranslateUi(this);
    37. break;
    38. default:
    39. break;
    40. }
    41. }
    42.  
    43. void MainWindow::on_pushButton_clicked()
    44. {
    45. if (iFBSession->resume() == false)
    46. {
    47. iLoginDialog = new FBLoginDialog();
    48. iLoginDialog->show();
    49. }
    50. }
    51.  
    52. void MainWindow::sessionDidLogin(FBUID aUid)
    53. {
    54. QMessageBox msgbox;
    55. UserId = QString::number(aUid,10);
    56. QString msg ("Logged in sucessfully, your FBUID is " + UserId);
    57. msgbox.setText(msg);
    58. msgbox.exec();
    59.  
    60. if (iLoginDialog)
    61. {
    62. iLoginDialog->deleteLater();;
    63. iLoginDialog = NULL;
    64. }
    65. }
    66.  
    67. void MainWindow::sessionDidLogout()
    68. {
    69. QMessageBox msgbox;
    70. msgbox.setText("logged out");
    71. msgbox.exec();
    72. }
    73.  
    74. void MainWindow::on_pushButton_2_clicked()
    75. {
    76. FBRequest* request = FBRequest::request();
    77. Dictionary params;
    78. QString query = "select name,pic_big, status,birthday_date, timezone from user where uid in (select uid2 from friend where uid1==" +UserId+ ")";
    79. params["query"] = query;
    80. connect (request, SIGNAL(requestDidLoad(QVariant)), this, SLOT(requestDidLoad(QVariant)));
    81. connect (request, SIGNAL(requestFailedWithFacebookError(FBError)), this, SLOT(requestFailedWithFacebookError(FBError)));
    82. request->call("facebook.fql.query",params);
    83.  
    84. }
    85.  
    86. void MainWindow::requestFailedWithFacebookError ( const FBError& aError )
    87. {
    88. qDebug() << "facebook error is " << aError.code() << " - " << aError.description();
    89. }
    90.  
    91. void MainWindow::requestDidLoad(const QVariant& aContainer)
    92. {
    93. if (aContainer.type() == QVariant::List)
    94. {
    95. QVariantList list = aContainer.toList();
    96.  
    97. for (int i = 0 ; i < list.count(); i ++)
    98. {
    99. QVariantHash dictionary = list.at(i).toHash();
    100. QHashIterator<QString, QVariant> iterator(dictionary);
    101.  
    102. QString name = dictionary.value("name").toString();
    103. ui->listWidget->addItem(name);
    104.  
    105.  
    106. }
    107.  
    108. sender()->deleteLater();
    109. }
    110. }
    111.  
    112.  
    113.  
    114. void MainWindow::on_buttonForget_clicked()
    115. {
    116. iFBSession->logout();
    117. }
    To copy to clipboard, switch view to plain text mode 



    After login the FB Errors show like this:

    Starting D:\WS\qfacebookconnect-qfacebookconnect\debug\sample.exe...
    Load started: QUrl( "" )
    Loading url: "http://www.facebook.com/login.php?api_key=xxxxxxxxxx&next=fbconnect://success&connect_display=touch&fbconnect=1"
    Load successfull for: QUrl( "http://m.facebook.com/login.php?api_key=xxxxxxxx&next=http://www.facebook.com/connect/uiserver.php?app_id=xxxxxxx&next=fbconnect%3A%2F%2 Fsuccess&display=touch&return_session=0&fbconnect= 1&canvas=0&legacy_return=1&method=permissions.requ est&connect_display=touch&fbconnect=1&app_id=xxxxx xxxx&skip_api_login=1&refsrc=http://www.facebook.com/login.php&_rdr" )
    Load started: QUrl( "http://m.facebook.com/login.php?api_key=xxxxxxxxx&next=http://www.facebook.com/connect/uiserver.php?app_id=xxxxxxxx&next=fbconnect%3A%2F% 2Fsuccess&display=touch&return_session=0&fbconnect =1&canvas=0&legacy_return=1&method=permissions.req uest&connect_display=touch&fbconnect=1&app_id=xxxx xx&skip_api_login=1&refsrc=http://www.facebook.com/login.php&_rdr" )
    QSslSocket: cannot call unresolved function SSLv3_client_method
    QSslSocket: cannot call unresolved function SSL_CTX_new
    QSslSocket: cannot call unresolved function SSL_library_init
    QSslSocket: cannot call unresolved function ERR_get_error
    Load un successfull for: QUrl( "http://m.facebook.com/login.php?api_key=xxxx&next=http://www.facebook.com/connect/uiserver.php?app_id=xxxxx&next=fbconnect%3A%2F%2Fs uccess&display=touch&return_session=0&fbconnect=1& canvas=0&legacy_return=1&method=permissions.reques t&connect_display=touch&fbconnect=1&app_id=xxxxxxx &skip_api_login=1&refsrc=http://www.facebook.com/login.php&_rdr" )
    1
    facebook error is 89 - "Parser error: unexpected ')' at position 112."
    facebook error is 89 - "Parser error: unexpected ')' at position 112."
    facebook error is 89 - "Parser error: unexpected ')' at position 112."
    facebook error is 89 - "Parser error: unexpected ')' at position 112."




    This is the .pro file
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2009-11-20T00:54:21
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += network webkit xml
    8.  
    9. TARGET = sample
    10. TEMPLATE = app
    11. DESTDIR = ../debug
    12.  
    13. SOURCES += main.cpp\
    14. mainwindow.cpp
    15.  
    16. HEADERS += mainwindow.h
    17.  
    18. FORMS += mainwindow.ui
    19.  
    20.  
    21. INCLUDEPATH = ../inc/
    22. win32:LIBS += ../debug/qfacebookconnect.lib
    23. unix:LIBS += ../debug/libqfacebookconnect.so
    24.  
    25. symbian: {
    26. TARGET.CAPABILITY = NetworkServices # Symbian specific, we just need network access
    27. TARGET.UID3 = 0xA89FA522 # Symbian specific, unprotected uid3 from symbiansigned.com
    28.  
    29. INCLUDEPATH += /epoc32/include/stdapis # this seems to be a bug.
    30. LIBS += -lqfacebookconnect
    31.  
    32. libqfacebookconnect.sources = qfacebookconnect.dll
    33. libqfacebookconnect.path = \sys\bin
    34. DEPLOYMENT += libqfacebookconnect
    35. }
    36.  
    37. ICON = gfx/fb.svg
    To copy to clipboard, switch view to plain text mode 

    qfacebookconnect.lib is pasted in the Debug folder

    Can you help me to run this project successfully

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Error in retrieving data from facebook to qt gui application

    I think you should ask the guy who created the FBRequest class.

Similar Threads

  1. retrieving data from a QWT plot
    By mobucl in forum Qwt
    Replies: 1
    Last Post: 26th May 2011, 13:00
  2. SQL Server data retrieving speed problem
    By Aleksandar in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2010, 13:52
  3. Debugger problem retrieving data for watch view hangs
    By frenk_castle in forum Installation and Deployment
    Replies: 0
    Last Post: 5th May 2010, 23:09
  4. Retrieving command line arguments inside a Qt application
    By prykHetQuo in forum Qt Programming
    Replies: 5
    Last Post: 14th February 2009, 14:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.