错误:#import <foundation foundation.h =“”>上的“Objective-C方法的预期选择器”和“预期方法体”

时间:2015-05-07 11:56:45

标签: ios objective-c xcode

尝试在模拟器上运行项目时,我得到了接下来的两个错误:

  1. Objective-C方法的预期选择器
  2. 预期方法正文
  3. 在AppDelegate.h文件中的#import <Foundation/Foundation.h>

    我尝试清理项目,关闭并打开Xcode,重新启动PC,试图找到一个类型-o,但我找不到任何,我必须补充说我没有对app delegate文件做任何更改当我从我的设备上的测试变为模拟器上的测试时,一切都发生了。

    这是我没有修改的确切代码:

    //
    //  AppDelegate.h
    //  ChannerApp
    //
    //  Created by Laurentiu on 20/02/15.
    //  Copyright (c) 2015 Laurentiu. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    #import "GroupsViewController.h"
    #import <FacebookSDK/FacebookSDK.h>
    #import <UIKit/UIKit.h>
    #import "XMPP.h"
    #import <CoreData/CoreData.h>
    #import "XMPPStream.h"
    #import "XMPPReconnect.h"
    #import "XMPPRoster.h"
    #import "XMPPRosterCoreDataStorage.h"
    #import "XMPPvCardCoreDataStorage.h"
    #import "XMPPvCardAvatarModule.h"
    #import "XMPPCapabilities.h"
    #import "XMPPCapabilitiesCoreDataStorage.h"
    #import "ConractsViewController.h"
    #import "StartViewController.h"
    #import "DDLog.h"
    #import "Reachability.h"
    #import "XMPPvCardTemp.h"
    
    
    @class StartViewController, GroupsViewController;
    
    @interface AppDelegate : UIResponder <UIApplicationDelegate, XMPPStreamDelegate, XMPPRosterDelegate, XMPPvCardTempModuleDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    
    @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
    @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
    @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
    @property (nonatomic, strong) StartViewController *notSignedInView;
    @property (nonatomic, strong) GroupsViewController *signedInView;
    ///////////////////////////////////////////////
    @property (nonatomic, strong, readonly) XMPPStream *xmppStream;
    @property (nonatomic, strong, readonly) XMPPReconnect *xmppReconnect;
    @property (nonatomic, strong, readonly) XMPPRoster *xmppRoster;
    @property (nonatomic, strong, readonly) XMPPRosterCoreDataStorage *xmppRosterStorage;
    @property (nonatomic, strong, readonly) XMPPvCardTempModule *xmppvCardTempModule;
    @property (nonatomic, strong, readonly) XMPPvCardAvatarModule *xmppvCardAvatarModule;
    @property (nonatomic, strong, readonly) XMPPCapabilities *xmppCapabilities;
    @property (nonatomic, strong, readonly) XMPPvCardCoreDataStorage *xmppvCardStorage;
    @property (nonatomic, strong, readonly) XMPPvCardTemp *storedvCard;
    ///////////////////////////////////////////////
    //all user values that should be saved
    @property (nonatomic, strong) NSString *userName;
    @property (nonatomic, strong) NSString *nickName;
    @property (strong, nonatomic) NSString *passwordText;
    @property (nonatomic, strong) NSString *firstName;
    @property (strong, nonatomic) NSString *lastName;
    @property (nonatomic, strong) NSString *emailAddress;
    @property (strong, nonatomic) NSString *avatarImage;
    @property (strong, nonatomic) NSString *gender;
    @property (nonatomic, strong) NSString *facebookInfo;
    @property (strong, nonatomic) NSString *linkedInInfo;
    @property (strong, nonatomic) NSString *birthdate;
    
    - (void)saveContext;
    - (NSURL *)applicationDocumentsDirectory;
    - (void)signInWith: (NSString *)username andPassword: (NSString *) password;
    - (void)teardownStream;
    - (BOOL)checkForNetwork;
    - (void)savevCardWithUsername:(NSString *)username andNickname:(NSString *)andNickname andPassword:(NSString *)andPassword andLastName:(NSString *)andLastName andBirthdate:(NSString *)andBirthdate andFirstName:(NSString *)andFirstName andEmailAddress:(NSString *)andEmailAddress andAvatarImage:(NSString *)andAvatarImage andGender:(NSString *)andGender andFBInfo:(NSString *)FBInfo andLinkedInInfo:(NSString *)LinkedInInfo;
    
    - (void)uploadvCard;
    
    @end
    

1 个答案:

答案 0 :(得分:2)

我在代码中发现了同样的错误。检查每个文件。在其他文件的顶部有额外的+符号。删除它,它工作正常。检查任何文件上是否有任何额外字符。