[英]Parse app not working on real device “clang: error: linker command failed with exit code 1” Swift 2.0 Xcode 7 beta 6
I have downloaded the parse core quick start swift Xcode project. 我已经下载了解析核心快速入门swift Xcode项目。 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. 它在模拟器中运行得非常好:我可以创建用户,上传数据等...但是当我尝试在物理设备上运行它时,我在Xcode中收到此错误: clang: error: linker command failed with exit code 1 (use -v to see invocation)
我确定我拥有所有需要的库,因为该项目来自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: FWI我正在使用Swift 2 Xcode 7 beta6。我不认为这是代码错误,但这是我的应用程序委托:
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.")
}
}
}
See if deleting your derived data folder fixes it. 查看删除衍生数据文件夹是否可以解决该问题。
Also, you may want to change your Parse keys, since you just posted them on StackOverflow. 另外,由于您刚刚将它们发布在StackOverflow上,因此您可能想要更改其解析键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.