Не удалось собрать модуль цели c
Я делал проект xcode с swift, и он работал нормально, но внезапно он начал выдавать мне эту ошибку.
Не удалось построить модуль Objective C 'Foundation'
/Users/admin/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSNotification.h:17:4: За атрибутом префикса должен следовать интерфейс или протокол
Даже когда я создаю новый проект и ничего не делаю, а просто строю его, эта ошибка отображается. Проект не построен. Когда я нажимаю на сообщение об ошибке, он приводит меня к этому файлу NSNotification.h
Вот содержимое этого файла
/* NSNotification.h
Copyright (c) 1994-2016, Apple Inc. All rights reserved.
*/
#import <Foundation/NSObject.h>
typedef NSString *NSNotificationName NS_EXTENSIBLE_STRING_ENUM;
@class NSString, NSDictionary, NSOperationQueue;
NS_ASSUME_NONNULL_BEGIN
/**************** Notifications ****************/
@interface NSNotification : NSObject <NSCopying, NSCoding>
id@property (nullable, readonly, retain) id object;
@property (nullable, readonly, copy) NSDictionary *userInfo;
- (instancetype)initWithName:(NSNotificationName)name object:(nullable id)object userInfo:(nullable NSDictionary *)userInfo NS_AVAILABLE(10_6, 4_0) NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
@end
@interface NSNotification (NSNotificationCreation)
+ (instancetype)notificationWithName:(NSNotificationName)aName object: (nullable id)anObject;
+ (instancetype)notificationWithName:(NSNotificationName)aName object: (nullable id)anObject userInfo:(nullable NSDictionary *)aUserInfo;
- (instancetype)init /*NSUIImagePNGRepresentation_UNAVAILABLE*/; /* do not invoke; not a valid initializer for this class */
@end
/**************** Notification Center ****************/
@interface NSNotificationCenter : NSObject {
@package
void *_impl;
void *_callback;
void *_pad[11];
}
#if FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST(8)
@property (class, readonly, strong) NSNotificationCenter *defaultCenter;
- (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject;
#endif
- (void)postNotification:(NSNotification *)notification;
- (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject;
- (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject userInfo:(nullable NSDictionary *)aUserInfo;
- (void)removeObserver:(id)observer;
- (void)removeObserver:(id)observer name:(nullable NSNotificationName)aName object:(nullable id)anObject;
- (id <NSObject>)addObserverForName:(nullable NSNotificationName)name object:(nullable id)obj queue:(nullable NSOperationQueue *)queue usingBlock:(void (^)(NSNotification *note))block NS_AVAILABLE(10_6, 4_0);
// The return value is retained by the system, and should be held onto by the caller in
// order to remove the observer with removeObserver: later, to stop observation.
@end
NS_ASSUME_NONNULL_END
Пожалуйста, помогите мне через это. Я буду очень благодарен за это. Благодарю.
1 ответ
Эта строка в NSNotification.h выглядит так, как будто она была изменена:
id@property (nullable, readonly, retain) id object;
Удалить id
в начале этой строки и попробуйте перекомпилировать. Это должно исправить это.