解析应用程序无法在真实设备上工作“clang:错误:链接器命令失败,退出代码为1”Swift 2.0 Xcode 7 beta 6

时间:2021-07-28 09:40:12

I have downloaded the parse core quick start swift Xcode project. It runs perfectly fine in the simulator: I can create users, upload data, etc... But when I try to run it on my physical device I get this error in Xcode: clang: error: linker command failed with exit code 1 (use -v to see invocation) I am sure that I have all the needed library's because the project is strait from parse.com. FWI I'm on Swift 2 Xcode 7 beta 6. I don't think that it's an error in the code but here is my app delegate:

我已经下载了解析核心快速启动swift Xcode项目。它在模拟器中运行得非常好:我可以创建用户,上传数据等...但是当我尝试在我的物理设备上运行它时,我在Xcode中出现此错误:clang:错误:链接器命令失败,退出代码为1(使用-v来查看调用)我确信我拥有所有需要的库,因为该项目来自parse.com。 FWI我在Swift 2 Xcode 7 beta 6上。我不认为这是代码中的错误,但这是我的app委托:

import UIKit
import Bolts
import Parse

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

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

        Parse.enableLocalDatastore()
        Parse.setApplicationId("XXXXXXXXXXXXXXXXXXXXXXXXXX",
            clientKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
        PFUser.enableAutomaticUser()

        let defaultACL = PFACL();
        defaultACL.setPublicReadAccess(true)
        PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser:true)

        return true
    }

    func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
        let installation = PFInstallation.currentInstallation()
        installation.setDeviceTokenFromData(deviceToken)
        installation.saveInBackground()

        PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
            if succeeded {
                print("good");
            } else {
                print("bad", error)
            }
        }
    }

    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
        if error.code == 3010 {
            print("Push notifications are not supported in the iOS Simulator.")
        } else {
            print("application:didFailToRegisterForRemoteNotificationsWithError: %@", error)
        }
    }

    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
        PFPush.handlePush(userInfo)
        if application.applicationState == UIApplicationState.Inactive {
            PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
        }
    }
}

And my ViewController.swift:

而我的ViewController.swift:

import UIKit
import Parse

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        let testObject = PFObject(className: "TestObject")
        testObject["foo"] = "bar"
        testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
            print("Object has been saved.")
        }
    }
}

1 个解决方案

#1


0  

See if deleting your derived data folder fixes it.

查看删除派生数据文件夹是否修复了它。

Also, you may want to change your Parse keys, since you just posted them on *.

此外,您可能想要更改Parse键,因为您刚刚将它们发布在*上。

#1


0  

See if deleting your derived data folder fixes it.

查看删除派生数据文件夹是否修复了它。

Also, you may want to change your Parse keys, since you just posted them on *.

此外,您可能想要更改Parse键,因为您刚刚将它们发布在*上。