将 Xcode 个项目注册到 Bluemix
Registration of Xcode Project to Bluemix
IMFClient.sharedInstance().initializeWithBackendRoute
每次我在 Xcode 6 中尝试这一行时,我都会收到此错误:
'Use of unresolved identifier IMF Client'
有什么办法可以解决吗?
您必须确保导入了正确的头文件并正确配置了 frameworks/Pods。看来您正在使用 swift 所以我将在下面添加说明:
1) 确保您已正确配置您的 pod 文件。下面是一个使用 IMF 服务的标准 Pod 文件,但您只需要包含您需要的资源(在您上面的例子中是 IMFCore):
source 'https://github.com/CocoaPods/Specs.git'
# Copy the following list as is and remove the dependencies you do not need
pod 'IMFCore'
pod 'IMFGoogleAuthentication'
pod 'IMFFacebookAuthentication'
pod 'IMFURLProtocol'
pod 'IMFPush'
pod 'IMFData'
2) 从终端转到您的项目文件夹并使用以下命令安装依赖项:
pod install
3) 现在打开 {AppName}.xcworkspace 而不是 .xcproject。在 pod 安装成功完成后,.xcworkspace 已正确配置所有 pods 和 decencies。
4) 在 swift 中,您需要在 Bridging-Header.h 中为您的头文件添加正确的导入语句。在使用 IMF 服务时,我将再次向您展示一个标准的 Bridging-Header.h 文件,但您只需要包括您需要的文件(至少在您的情况下是 IMFCore):
#import <Foundation/Foundation.h>
#import <CDTDatastore/CloudantSync.h>
#import <CloudantToolkit/CloudantToolkit.h>
#import <IMFCore/IMFCore.h>
#import <IMFPush/IMFPush.h>
#import <facebookSDK/FacebookSDK.h>
#import "IMFFacebookAuthenticationHandler.h"
#import "IMFGoogleAuthenticationHandler.h"
#import <IMFData/IMFData.h>
正确安装和配置依赖项后,您应该能够使用以下方法将客户端注册到后端:
IMFClient.sharedInstance().initializeWithBackendRoute(applicationRoute, backendGUID: applicationId)
请注意:您需要将您的 applicationRoute 和 applicationId 添加到上面。当您注册客户端时,这些变量将显示在 AMA 仪表板上。
如果您想在使用 Objective-C 时看到类似的说明,请参阅以下内容:
https://www.ng.bluemix.net/docs/starters/mobilefirst/gettingstarted/existingproject.html#createapp
IMFClient.sharedInstance().initializeWithBackendRoute
每次我在 Xcode 6 中尝试这一行时,我都会收到此错误:
'Use of unresolved identifier IMF Client'
有什么办法可以解决吗?
您必须确保导入了正确的头文件并正确配置了 frameworks/Pods。看来您正在使用 swift 所以我将在下面添加说明:
1) 确保您已正确配置您的 pod 文件。下面是一个使用 IMF 服务的标准 Pod 文件,但您只需要包含您需要的资源(在您上面的例子中是 IMFCore):
source 'https://github.com/CocoaPods/Specs.git'
# Copy the following list as is and remove the dependencies you do not need
pod 'IMFCore'
pod 'IMFGoogleAuthentication'
pod 'IMFFacebookAuthentication'
pod 'IMFURLProtocol'
pod 'IMFPush'
pod 'IMFData'
2) 从终端转到您的项目文件夹并使用以下命令安装依赖项:
pod install
3) 现在打开 {AppName}.xcworkspace 而不是 .xcproject。在 pod 安装成功完成后,.xcworkspace 已正确配置所有 pods 和 decencies。
4) 在 swift 中,您需要在 Bridging-Header.h 中为您的头文件添加正确的导入语句。在使用 IMF 服务时,我将再次向您展示一个标准的 Bridging-Header.h 文件,但您只需要包括您需要的文件(至少在您的情况下是 IMFCore):
#import <Foundation/Foundation.h>
#import <CDTDatastore/CloudantSync.h>
#import <CloudantToolkit/CloudantToolkit.h>
#import <IMFCore/IMFCore.h>
#import <IMFPush/IMFPush.h>
#import <facebookSDK/FacebookSDK.h>
#import "IMFFacebookAuthenticationHandler.h"
#import "IMFGoogleAuthenticationHandler.h"
#import <IMFData/IMFData.h>
正确安装和配置依赖项后,您应该能够使用以下方法将客户端注册到后端:
IMFClient.sharedInstance().initializeWithBackendRoute(applicationRoute, backendGUID: applicationId)
请注意:您需要将您的 applicationRoute 和 applicationId 添加到上面。当您注册客户端时,这些变量将显示在 AMA 仪表板上。
如果您想在使用 Objective-C 时看到类似的说明,请参阅以下内容:
https://www.ng.bluemix.net/docs/starters/mobilefirst/gettingstarted/existingproject.html#createapp