Cordova iOS版本的Bluemix推送插件错误

Cordova iOS版本的Bluemix推送插件错误,ios,push-notification,ibm-cloud,ibm-mobile-services,ibm-cloud-plugin,Ios,Push Notification,Ibm Cloud,Ibm Mobile Services,Ibm Cloud Plugin,我正在尝试将bluemix推送服务集成到我的Cordova应用程序中。使用以下链接中的示例: 当我在iOS上遵循这个过程并尝试构建应用程序时,它在框架的IMFClient上给了我以下错误 更新: 如果未在示例中正确配置桥接头.h文件,您将看到该错误 请看 在AppDelegate.m的顶部: #导入“[您的项目名称]-Swift.h” 如果项目名称中有空格或连字符,请在import语句中将其替换为下划线 然后从 添加桥接标头。转到生成设置>Swift编译器-代码 生成>目标-C桥接标头并添加以

我正在尝试将bluemix推送服务集成到我的Cordova应用程序中。使用以下链接中的示例:

当我在iOS上遵循这个过程并尝试构建应用程序时,它在框架的IMFClient上给了我以下错误

更新:


如果未在示例中正确配置桥接头.h文件,您将看到该错误

请看

在AppDelegate.m的顶部:

#导入“[您的项目名称]-Swift.h”

如果项目名称中有空格或连字符,请在import语句中将其替换为下划线

然后从

添加桥接标头。转到生成设置>Swift编译器-代码 生成>目标-C桥接标头并添加以下路径:

[您的项目名称]/Plugins/ibm-mfp-core/bridgeing-Header.h


希望这有帮助。

这也可能有帮助:在前面的问题中,我编写了设置Cordova和iOS的步骤

请记住,您还必须禁用位代码


我能够通过以下步骤运行
bms示例cordova hellopush
示例应用程序:

  • 克隆样本:

    git克隆https://github.com/ibm-bluemix-mobile-services/bms-samples-cordova-hellopush

  • 在my
    [您的目录]/www/js/index.js
    中添加了my应用程序路径应用程序GUID(在Bluemix上为my Mobile Services Starter应用程序配置推送通知后

  • 将iOS平台添加到我的应用程序:

    cordova平台添加ios@3.9

  • 添加了Cordova插件:

    cordova插件添加ibm mfp推送

  • 使用Xcode打开我的
    [你的应用程序名].xcodeproj
    文件,该文件位于我的
    [你的应用程序名]/platforms/ios
    目录中(当提示我:转换为最新的Swift语法时,我单击了取消

  • 添加了桥接头。转到
    Build settings>Swift编译器-代码生成>Objective-C桥接头
    ,并添加了以下路径:

    [您的项目名称]/Plugins/ibm-mfp-core/bridgeing-Header.h

  • 添加Frameworks参数。转到
    构建设置>链接>运行路径搜索路径
    并添加以下参数:

    @可执行路径/框架

  • 已建项目

  • 在我的桥接头中取消对以下推送导入语句的注释。转到
    [您的项目名称]/Plugins/ibm mfp core/bridgeting header.h

  • 更新了我的客户端应用程序以使用推送SDK
  • 这是我更新的
    AppDelegate.m

    /*
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
    
     http://www.apache.org/licenses/LICENSE-2.0
    
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
     */
    
    //
    //  AppDelegate.m
    //  bms-samples-cordova-push
    //
    //  Created by ___FULLUSERNAME___ on ___DATE___.
    //  Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
    //
    
    #import "AppDelegate.h"
    #import "MainViewController.h"
    #import "bms_samples_cordova_push-Swift.h"
    
    
    #import <Cordova/CDVPlugin.h>
    
    @implementation AppDelegate
    
    @synthesize window, viewController;
    
    - (id)init
    {
        /** If you need to do any extra app-specific initialization, you can do it here
         *  -jm
         **/
        NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    
        [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
    
        int cacheSizeMemory = 8 * 1024 * 1024; // 8MB
        int cacheSizeDisk = 32 * 1024 * 1024; // 32MB
    #if __has_feature(objc_arc)
            NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
    #else
            NSURLCache* sharedCache = [[[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"] autorelease];
    #endif
        [NSURLCache setSharedURLCache:sharedCache];
    
        self = [super init];
        return self;
    }
    
    #pragma mark UIApplicationDelegate implementation
    
    /**
     * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
     */
    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
        CGRect screenBounds = [[UIScreen mainScreen] bounds];
    
    #if __has_feature(objc_arc)
            self.window = [[UIWindow alloc] initWithFrame:screenBounds];
    #else
            self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
    #endif
        self.window.autoresizesSubviews = YES;
    
    #if __has_feature(objc_arc)
            self.viewController = [[MainViewController alloc] init];
    #else
            self.viewController = [[[MainViewController alloc] init] autorelease];
    #endif
    
        // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml.
        // If necessary, uncomment the line below to override it.
        // self.viewController.startPage = @"index.html";
    
        // NOTE: To customize the view's frame size (which defaults to full screen), override
        // [self.viewController viewWillAppear:] in your view controller.
    
        [[CDVMFPPush sharedInstance] didReceiveRemoteNotificationOnLaunch:launchOptions];
    
        self.window.rootViewController = self.viewController;
        [self.window makeKeyAndVisible];
    
        return YES;
    }
    
    // this happens while we are running ( in the background, or from within our own app )
    // only valid if bms-samples-cordova-push-Info.plist specifies a protocol to handle
    - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
    {
        if (!url) {
            return NO;
        }
    
        // all plugins will get the notification, and their handlers will be called
        [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
    
        return YES;
    }
    
    // repost all remote and local notification using the default NSNotificationCenter so multiple plugins may respond
    - (void)            application:(UIApplication*)application
        didReceiveLocalNotification:(UILocalNotification*)notification
    {
        // re-post ( broadcast )
        [[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification];
    }
    
    
    #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
    - (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
    #else
    - (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
    #endif
    {
        // iPhone doesn't support upside down by default, while the iPad does.  Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected).
        NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown);
    
        return supportedInterfaceOrientations;
    }
    
    - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
    {
        [[NSURLCache sharedURLCache] removeAllCachedResponses];
    }
    
    // Register device token with Bluemix Push Notification Service
    - (void)application:(UIApplication *)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
        
        [[CDVMFPPush sharedInstance] didRegisterForRemoteNotifications:deviceToken];
    }
    
    // Handle error when failed to register device token with APNs
    - (void)application:(UIApplication*)application
    didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
        
        [[CDVMFPPush sharedInstance] didFailToRegisterForRemoteNotifications:error];
    }
    
    // Handle receiving a remote notification
    -(void)application:(UIApplication *)application
    didReceiveRemoteNotification:(NSDictionary *)userInfo
    fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
        
        [[CDVMFPPush sharedInstance] didReceiveRemoteNotification:userInfo];
    }
    
    @end
    
    /*
    授权给Apache软件基金会(ASF)
    一个或多个参与者许可协议。请参阅通知文件
    与此工作一起分发以获取更多信息
    关于版权所有权。ASF许可此文件
    根据Apache许可证,版本2.0(
    “许可证”);除非符合规定,否则不得使用此文件
    使用许可证。您可以通过以下方式获得许可证副本:
    http://www.apache.org/licenses/LICENSE-2.0
    除非适用法律要求或书面同意,
    根据许可证分发的软件在
    “按原样”的基础上,没有任何
    种类,明示或暗示。有关
    管理权限和限制的特定语言
    根据许可证。
    */
    //
    //AppDelegate.m
    //科多瓦推送
    //
    //由日期为的完整用户名创建。
    //版权所有-组织名称-年份-保留所有权利。
    //
    #导入“AppDelegate.h”
    #导入“MainViewController.h”
    #导入“bms\u样本\u cordova\u push-Swift.h”
    #进口
    @实现AppDelegate
    @综合窗口、视图控制器;
    -(id)init
    {
    /**如果您需要执行任何额外的特定于应用程序的初始化,可以在此处执行
    *-jm
    **/
    NSHTTPPCookieStorage*cookieStorage=[NSHTTPPCookieStorage SharedHTTPPCookieStorage];
    [cookieStorage设置CookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
    int cacheSizeMemory=8*1024*1024;//8MB
    int cacheSizeDisk=32*1024*1024;//32MB
    #如果uu具有u特征(objc_u弧)
    NSURLCache*sharedCache=[[NSURLCache alloc]initWithMemoryCapacity:cacheSizeMemory diskCapacity:CacheSizeDiskPath:@“NSURLCache”];
    #否则
    NSURLCache*sharedCache=[[NSURLCache alloc]initWithMemoryCapacity:cacheSizeMemory diskCapacity:CacheSizeDiskPath:@“NSURLCache”]自动释放];
    #恩迪夫
    [NSURLCache setSharedURLCache:sharedCache];
    self=[super init];
    回归自我;
    }
    #pragma标记UIApplicationLegate实现
    /**
    *这是应用程序初始化后的主要启动,视图和设置在此设置。(首选-iOS4及以上)
    */
    -(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
    {
    CGRect屏幕边界=[[UIScreen mainScreen]边界];
    #如果uu具有u特征(objc_u弧)
    self.window=[[UIWindow alloc]initWithFrame:screenBounds];
    #否则
    self.window=[[UIWindow alloc]initWithFrame:screenBounds]autorelease];
    #恩迪夫
    self.window.autoresizesSubviews=是;
    #如果uu具有u特征(objc_u弧)
    self.viewController=[[MainViewController alloc]init];
    #否则
    self.viewController=[[MainViewController alloc]init]autorelease];
    #恩迪夫
    //通过在config.xml中设置标记来设置应用程序的起始页。
    //如有必要,取消注释下面的行以覆盖它。
    //self.viewController.startPage=@“index.html”;
    //注意:要自定义视图的帧大小(默认为全屏),请覆盖
    //[self.viewController视图将出现在视图控制器中:]。
    [[CDVMFPPush sharedInstance]DidReceivereMoteNotificationsLaunch:launchOpti