我在 Xcode 上有这些消息
duplicate symbol _OBJC_IVAR_$_Cars._color in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._brand in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._place in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._state in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_CLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_METACLASS_$_Cars in:
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
/Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
ld: 6 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
它提到的重复符号不是重复的。这些是在我的 Cars 类中声明的四个属性,如下所示:
@property (nonatomic, copy) void (^color)();
@property (nonatomic, copy) void (^brand)(Cars *oneCar, NSSet *touches);
@property (nonatomic, strong) NSString *place;
@property (nonatomic, assign) NSString *state;
另一个类 SpriteSlider 没有这些属性。怎么可能重复?
我如何发现问题。Xcode 可以给出更详细的消息吗?谢谢
不,相同的类在构建阶段不会被编译两次。