为什么我收到Apple Mach-O Linker错误?

时间:2014-04-17 19:46:38

标签: ios objective-c parse-platform mach-o

我正在努力让一个项目与Parse和Facebook合作。运行此项目时,构建失败,我得到Mach-O Linker Error

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_SLComposeViewController", referenced from:
  objc-class-ref in Parse(PF_Twitter.o)
  "_OBJC_CLASS_$_SLRequest", referenced from:
  objc-class-ref in Parse(PF_Twitter.o)
  "_SLServiceTypeTwitter", referenced from:
       -[PF_Twitter getAccessTokenForReverseAuthAsync:localTwitterAccount:] in  Parse(PF_Twitter.o)
      -[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ViewController.h:

#import <UIKit/UIKit.h>
#import <Parse/Parse.h>

@interface ViewController : UIViewController

@end

// Implement both delegates
@interface DefaultSettingsViewController :
UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>

@end

ViewController.m:

#import "ViewController.h"


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{



[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

// 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];
}


// 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");
}


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

if (![PFUser currentUser]) {
    // Customize the Log In View Controller
    PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
    [logInViewController setDelegate:self];
    [logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", nil]];
    [logInViewController setFields: PFLogInFieldsFacebook | PFLogInFieldsDismissButton];

    // Present Log In View Controller
    [self presentViewController:logInViewController animated:YES completion:NULL];
}
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
}

 @end

感谢任何帮助,谢谢。

2 个答案:

答案 0 :(得分:25)

从我看来,您似乎没有在项目中添加Social.framework。尝试按照那里的说明链接它:

Linking to a Library or Framework

答案 1 :(得分:0)

只需添加:

<framework>Social</framework>

<frameworks>标记下的robovm.xml。