當我嘗試輸入此代碼時,Xcode說我'使用未聲明的標識符'completedWithResult''。這是在Quickblox上推送通知的代碼。有一段代碼:'使用未聲明的標識符'completedWithResult''
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/// Set QuickBlox credentials (You must create application in admin.quickblox.com)
[QBSettings setApplicationID:XX];
[QBSettings setAuthorizationKey:@"XX"];
[QBSettings setAuthorizationSecret:@"XX"];
//
// If you use Push Notifications - you have to use lines bellow when you upload your application to Apple Store or create AdHoc.
//
[QBSettings useProductionEnvironmentForPushNotifications:YES];
QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
extendedAuthRequest.devicePlatorm = DevicePlatformiOS;
extendedAuthRequest.deviceUDID = [[UIDevice currentDevice] uniqueIdentifier];
extendedAuthRequest.userLogin = @"yourUserLogin";
extendedAuthRequest.userPassword = @"yourUserPassword";
[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];
// QuickBlox queries delegate
- (void)completedWithResult:(Result *)result{
if(result.success){
// Create session result
if([result isKindOfClass:QBAAuthSessionCreationResult.class]){
// register for receive push notifications
[QBMessages TRegisterSubscriptionWithDelegate:self];
// Register for receive push notifications result
}else if([result isKindOfClass:QBMRegisterSubscriptionTaskResult.class]){
// Congrats! Now you can receive Push Notifications!
}
}
}
的錯誤是在這條線:
// QuickBlox queries delegate
- (void)completedWithResult:(Result *)result{
if(result.success){
它說,「使用未聲明的標識符的「completedWithResult」
請人幫忙嗎?謝謝!
您可能想從此代碼示例中刪除您的應用程序密鑰。 –
哦,是的,謝謝! :facepalm: –