试图从swift访问id类方法

时间:2014-11-27 10:47:52

标签: ios swift soundcloud

我正在尝试从我的Swift代码中从Soundcloud iOS SDK访问以下方法但没有成功(该方法似乎无法访问,自动完成也不会显示它)。任何提示?

+ (id)   performMethod:(SCRequestMethod)aMethod
            onResource:(NSURL *)resource
       usingParameters:(NSDictionary *)parameters
           withAccount:(SCAccount *)account
sendingProgressHandler:(SCRequestSendingProgressHandler)progressHandler
       responseHandler:(SCRequestResponseHandler)responseHandler;

2 个答案:

答案 0 :(得分:0)

在我的桥接头文件中,我包含了

#import "SCAPI.h"

现在要制作任何类方法我只需调用SCSoundCloud。*或SCRequest。*并且自动完成就可以了。您是否在Build Phases下添加了SoundCloud库 - >链接二进制文件与库?

答案 1 :(得分:0)

SCRequest上的该类方法是这样桥接的:

class func perform(_           aMethod: SCRequestMethod,
                   onResource resource: URL!,
            usingParameters parameters: [AnyHashable : Any]!,
                          with account: SCAccount!,
sendingProgressHandler progressHandler: SCRequestSendingProgressHandler!,
             responseHandler: SCRequestResponseHandler!) -> Any!

确保通过CocoaPods安装框架,并将#import <CocoaSoundCloudAPI/SCAPI.h>添加到桥接头中。