Apple Mach O链接器错误objc_class _ $ _ PFSignUpView

时间:2015-08-20 06:33:03

标签: ios objective-c login parse-platform

我一直在按照解析文档创建登录并注册我的应用。它给出了以下错误:

Apple Mach O  linker error objc_class_$_PFSignUpView
ld: warning: Auto-LinkAing supplied '/Users/Carson/Documents/CC/APP Dev/parse-library-1.8.0/ParseUI.framework/ParseUI', framework linker option at /Users/Carson/Documents/CC/APP Dev/parse-library-1.8.0/ParseUI.framework/ParseUI is not a dylib
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_PFLogInViewController", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_PFSignUpViewController", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

任何帮助都会得到很好的接受

以下是我输入的代码:

ViewController.h

//
//  ViewController.h
//  Parse3
//
//  Created by Carson Carbery on 8/20/15.
//  Copyright (c) 2015 Carson Carbery. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import <ParseUI/PFCollectionViewCell.h>
#import <ParseUI/PFImageView.h>
#import <ParseUI/PFLogInView.h>
#import <ParseUI/PFLogInViewController.h>
#import <ParseUI/PFProductTableViewController.h>
#import <ParseUI/PFPurchaseTableViewCell.h>
#import <ParseUI/PFQueryCollectionViewController.h>
#import <ParseUI/PFQueryTableViewController.h>
#import <ParseUI/PFSignUpView.h>
#import <ParseUI/PFSignUpViewController.h>
#import <ParseUI/PFTableViewCell.h>
#import <ParseUI/PFTextField.h>
#import <ParseUI/ParseUIConstants.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>






// Implement both delegates


@interface ViewController : UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>


@end

ViewController.m

//  ViewController.m
//  Parse3
//
//  Created by Carson Carbery on 8/20/15.
//  Copyright (c) 2015 Carson Carbery. All rights reserved.
//

#import "ViewController.h"


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.



}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    if (![PFUser currentUser]) { // No user logged in
        // Create the log in view controller
        PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
        [logInViewController setDelegate:self]; // Set ourselves as the delegate

        // Create the sign up view controller
        PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
        [signUpViewController setDelegate:self]; // Set ourselves as the delegate

        // Assign our sign up controller to be displayed from the login controller
        [logInViewController setSignUpController:signUpViewController];

        // Present the log in view controller
        [self presentViewController:logInViewController animated:YES completion:NULL];
    }
}


// PF LOGIN METHODS


// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)loginViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
    // Check if both fields are completed
    if (username && password && username.length != 0 && password.length != 0) {
        return YES; // Begin login process
    }

    [[[UIAlertView alloc] initWithTitle:@"Missing Information"
                                message:@"Make sure you fill out all of the information!"
                               delegate:nil
                      cancelButtonTitle:@"ok"
                      otherButtonTitles:nil] show];
    return NO; // Interrupt login process
}


// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
    [self dismissViewControllerAnimated:YES completion:NULL];
}


// Sent to the delegate when the log in attempt fails.
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
    NSLog(@"Failed to log in...");
}

// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
    [self.navigationController popViewControllerAnimated:YES];
}


// PF SIGNUP METHODS

// Sent to the delegate to determine whether the sign up request should be submitted to the server.
- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
    BOOL informationComplete = YES;

    // loop through all of the submitted data
    for (id key in info) {
        NSString *field = [info objectForKey:key];
        if (!field || field.length == 0) { // check completion
            informationComplete = NO;
            break;
        }
    }

    // Display an alert if a field wasn't completed
    if (!informationComplete) {
        [[[UIAlertView alloc] initWithTitle:@"Missing Information"
                                    message:@"Make sure you fill out all of the information!"
                                   delegate:nil
                          cancelButtonTitle:@"ok"
                          otherButtonTitles:nil] show];
    }

    return informationComplete;
}

//// Sent to the delegate when a PFUser is signed up.
//- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
//    [self dismissModalViewControllerAnimated:YES]; // Dismiss the PFSignUpViewController
//}

// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
    NSLog(@"Failed to sign up...");
}

// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
    NSLog(@"User dismissed the signUpViewController");
}

1 个答案:

答案 0 :(得分:0)

这是因为PFLoginViewControllerPFSignUpViewController不属于标准Parse发行版和SDK。

相反,they are a drop-in class (named ParseUI-iOS) where the code is found here(下载链接和GitHub链接,以及如何专门使用它们的教程)。

您需要将这些文件添加到项目中,以便能够选择并编译它们。