2012-07-10 3 views
0

저는 최근에 php를 사용하여 페이스 북 앱을 개발했습니다. 앱은 모든 브라우저에서 작동하지만 사파리에는 없지만 사용자 벽에 게시하려고하면 첫 번째 앱 단계로 돌아갑니다. 다음은 내 코드입니다.Safari에서 Facebook 앱이 작동하지 않습니다.

내 앱은 사용자 친구 목록을 표시하고 친구를 선택하고 벽에 게시 할 수 있습니다. "개인 정보 보호"아래 사파리 환경 설정, 설정 "쿠키 차단"에

<?php 

    require ("facebook-api/src/facebook.php"); 
    $facebook = new Facebook(array(
    'appId' => '####', 
    'secret' => '####', 
    'cookie' => true, 
    )); 

    // Login or logout url will be needed depending on current user state. 
    $params = array(
    'scope' => 'email,user_birthday,friends_photos,publish_stream', 
    'redirect_uri' => 'https://apps.facebook.com/appname/' 
    ); 

    if ($user) { 
    $logoutUrl = $facebook->getLogoutUrl(); 
    } else { 
    $loginUrl = $facebook->getLoginUrl($params); 
    } 

    $user = $facebook->getUser(); 

    if ($user) { 

    $friends = $facebook->api('me/friends'); 
    $uids = ""; 

    foreach($friends as $f) { 
    $uids .= "uid=$f OR "; 
    } 

    $user_id_sess = $_SESSION['userid']; 
    $query_uids = substr($uids,0,strlen($query_uids)-4); 
    date_default_timezone_set('UTC'); 
    $today = date('m\/d'); 

    $data = $facebook->api(array('method'=>'fql.query','req_perms' => 'friends_birthday','query'=>"select uid,sex,name,birthday from user where uid in (select uid2 from friend where uid1=me()) ORDER by name ASC")); 

    echo " 
    <div class='span12 center-align' style='display:none;' id='block3'> 
    <form id='frmFb' name='frmFb' action='".$_SERVER['PHP_SELF']."' method='post' > 
    <p><img src='../static/images/logo.png' alt='logo' /></p> 
    <br /> 
    <h1 style='margin-bottom:10px;'>Share with your friends</h1> 
    <p id='progress' style='display:none;'><img src='static/img/processing.gif' alt='Processing' /></p> 
    <div class='center-align well pull-center' style='max-height:300px; overflow:auto;'> 
    "; 

    foreach($data as $today_bday) { 

    //$table='user_recipient'; 
    $remfbid = $today_bday['uid']; 
    $fb_bday = $today_bday['birthday']; 

    echo " 
    <div style='width:50px; height:110px; margin:15px; float:left;' class='center-align'> 
    <a href='#' class='thumbnail'><img src='https://graph.facebook.com/".$today_bday['uid']."/picture' class='friend' alt='".$today_bday['name']."'></a> 
    <input type='checkbox' name='fbchoose[]' value='".$today_bday['uid']."'> 
    <p><small>".$today_bday['name']."</small></p> 
    <br/><br/> 
    </div>  
    "; 
    } 
    echo " 
    </div> 
    <br /> 
    <a href='#' class='btn btn-inverse btn-large'><i class='icon-ban-circle icon-white' style='margin-top:4px;'></i> CANCEL</a><input type='submit' value='SHARE NOW' name='btnAddReminder' class='btn btn-success btn-large' onclick='show()'> 
    </form> 
    </div> 
    "; 
    } else { 
    echo "<p><script>top.location.href='$loginUrl';</script></p> 
    "; 
    } 
    ?> 
    <? 

    if(isset($_REQUEST['btnAddReminder'])){ 

    if($_POST['fbchoose'] == "") { 
    $error_msg = "<div class='alert pull-center alert-error'><i class='icon-warning-sign' style='margin-top:2px;'></i> Please select at least one friend to share</div><br/>"; 
    } 
    else { 

    foreach($_POST['fbchoose'] as $row) { 


    $vars = array(
    'message' => 'Message...', 
    'name' => 'Name..', 
    'caption' => 'Caption', 
    'link' => 'Link', 
    'description' => 'Description', 
    'picture' => 'Picture...' 
    ); 

    $facebook->api("/".$row ."/feed", 'post', $vars); 
    } 


    echo "<script>location.href='http://www.mywebsite.com/';</script>"; 

    } 
    } 
    ?> 
+0

가능한 중복 : //facebook.stackoverflow. com/questions/9930671/safari-third-party-cookie-iframe-trick-no-longer-working) – Igy

답변

2

사용 안 [사파리 3 자 쿠키 iframe이 트릭을 더 이상 작동?] (HTTP의

+0

프로그래밍 방식으로 수행 할 수있는 방법이 있습니까? 사용자에게 Safari 환경 설정을 변경하도록 요청할 수는 없습니다. –

+1

@tamal 사파리 사용자를 대상으로하는 정보 제공 이미지를 사용했습니다. [link] http://cl.ly/451T0P1Z352a3R1o3u1o – vedran

+0

Vedran! 그것은 나를 위해 2 개의 두통을 결론 지었다! –

관련 문제