简体   繁体   English

将Parse集成到Swift应用程序时出错

[英]Error with Parse integration into Swift app

I am trying to integrate Parse into a Swift app. 我正在尝试将Parse集成到Swift应用程序中。 I downloaded the SDK, set the app id and added the dependencies, but when I try to import Parse, it says 'No such module - Parse'. 我下载了SDK,设置了应用ID,并添加了相关性,但是当我尝试导入Parse时,它说“没有这样的模块-Parse”。

Check that the Parse framework has been copied to your project folder to wherever you keep your 3rd party dependencies (eg Vendor ). 检查Parse框架是否已复制到您的项目文件夹中,无论您将第3方依赖项保留在哪里(例如Vendor )。

Then, add the path to the Parse framework to the Framework Search Paths (FRAMEWORK_SEARCH_PATHS) for your build target. 然后,将解析框架的路径添加到构建目标的框架搜索路径(FRAMEWORK_SEARCH_PATHS)中。

It should look something like this: 它看起来应该像这样:

$(inherited)
$(PROJECT_DIR)/Vendor/Parse

I'd clean up the DerivedData folder and rebuild. 我将清理DerivedData文件夹并重建。

I think this link should be solve your Problem: Set up new Parseproject or here ist explained it for a existing project please check this 我认为此链接应该可以解决您的问题: 设置新的Parseproject在此处为现有项目进行解释,请检查此链接

Edit after i saw the Code. 看到代码后进行编辑。 At first please do not post api keys here this are your private api keys. 首先,请不要发布api密钥,这是您的私有api密钥。

second i think the code should look like: 第二,我认为代码应如下所示:

func application(application: UIApplication, didFinishLaunchingWithOptions   launchOptions: [NSObject: AnyObject]?) -> Bool {
    Parse.enableLocalDatastore()

    // Initialize Parse.
    Parse.setApplicationId("appID",
        clientKey: "Key")

    // [Optional] Track statistics around application opens.
    PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)

  //end parse


    // Override point for customization after application launch.
    let splitViewController = self.window!.rootViewController as! UISplitViewController
    let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
    navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
    splitViewController.delegate = self

    let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
    let controller = masterNavigationController.topViewController as! MasterViewController
    controller.managedObjectContext = self.managedObjectContext
    return true
 }

you have to put in your Key i corrected the method for you 您必须输入密钥,我为您更正了该方法

My problem appears to have been in the naming of the application: I included a number. 我的问题似乎出在应用程序的命名上:我包括了一个数字。

Once I corrected this, the error disappeared. 一旦我纠正了这个错误,错误就消失了。 Perhaps the name prevents the import of certain frameworks. 该名称可能会阻止某些框架的导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM