FBRequestConnection.startWithGraphPath быстро падает

Я использую Facebook SDK для получения данных профиля пользователя в swift, но вызываю FBRequestConnection.startWithGraphPath: завершение Handler: происходит сбой swift.

Я оставлю то, что я считаю соответствующей частью журнала

1.  While type-checking 'profile' at /Users/fratelli/Documents/Projects/Wink/Wink/OAuthFacebookSession.swift:118:14
2.  While type-checking expression at [/Users/fratelli/Documents/Projects/Wink/Wink/OAuthFacebookSession.swift:139:9 - line:142:9] RangeText="FBRequestConnection.startWithGraphPath(
            self.readPermissions(),
            completionHandler: completionHandler
        )"
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254

Я уже заполнил отчет об ошибке. Теперь, кроме использования Objective-C, я не вижу другого пути решения этой проблемы. Я хотел бы знать, есть ли какой-нибудь другой метод FB SDK, который я мог бы попробовать, чтобы добиться того же эффекта.

Вот код:

    var completionHandler = {
        connection, result, error in
    } as FBSessionStateHandler;

    // Request the profile info
    FBRequestConnection.startWithGraphPath(
        "me?fields=birthday,gender,first_name,last_name,name_format,picture",
        completionHandler: completionHandler
    );

2 ответа

Решение

В итоге мне пришлось использовать Objective-c. Поэтому я создал файл OAuthFacebookWrapper.h

#import <Foundation/Foundation.h>
#import <FacebookSDK/FacebookSDK.h>

@interface OAuthFacebookWrapper : NSObject

+ (void) startWithGraphPath:(NSString *)graphPath completionHandler:(FBRequestHandler)handler;

@end

Тогда OAuthFacebookWrapper.m

#import "OAuthFacebookWrapper.h"

@implementation OAuthFacebookWrapper

+ (void) startWithGraphPath:(NSString *)graphPath completionHandler:(FBRequestHandler)handler
{
    [FBRequestConnection startWithGraphPath: graphPath completionHandler: handler];
}

@end

Вызов этого метода с теми же аргументами, что и раньше, работает.

Попробуй это:

var completionHandler = {
    connection, result, error in
} as FBRequestHandler;

// Request the profile info
FBRequestConnection.startWithGraphPath(
    "me?fields=birthday,gender,first_name,last_name,name_format,picture",
    completionHandler: completionHandler
);

FBRequestConnection.startWithGraphPath ожидает FBRequestHandler, а не FBSessionStateHandler

Другие вопросы по тегам