-6ren"> -尝试在模拟器上运行项目时出现以下两个错误: Objective-C 方法的预期选择器 预期方法体 在 #import 在 AppDelegate.h 文件中 我尝试清理项目,关闭并打开 Xcode,重-6ren">
gpt4 book ai didi

ios - 错误 : "Expected selector for Objective-C method" and "Expected method body" on #import

转载 作者:行者123 更新时间:2023-12-01 18:52:34 26 4
gpt4 key购买 nike

尝试在模拟器上运行项目时出现以下两个错误:

  • Objective-C 方法的预期选择器
  • 预期方法体

  • #import <Foundation/Foundation.h>在 AppDelegate.h 文件中

    我尝试清理项目,关闭并打开 Xcode,重新启动 PC,试图找到一个 type-o,但我找不到,我必须补充一点,我没有对应用程序委托(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

    最佳答案

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

    关于ios - 错误 : "Expected selector for Objective-C method" and "Expected method body" on #import <Foundation/Foundation. h>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30100376/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com