Xcode 6 linker error - Undefined symbols for architecture armv7

前端 未结 10 2081
粉色の甜心
粉色の甜心 2021-01-31 10:15

After upgrading to Xcode 6 beta 7 (and now still with Xcode 6 GM) I am unable to link my Swift app. I receive errors such as:

Undefined symbols for archit

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 10:36

    I am a filly when it comes to iOS Objective C, though I have been coding in several other languages for many years. So I am stabbing around in the dark most of the time with Objective C.

    I started having this error, "Undefined symbols for architecture armv7", directly after declaring some "global" variables in my .h file like so:

    extern NSString *globalNotes;
    extern NSString *globalUserCountry;
    

    I was then referring to these variables from the .m file like so:

    globalNotes= @"Error (Marker 1010)";
    globalUserCountry= @"No result";
    

    THE FIX - To correct this, I changed them to object properties like so:

    @property(nonatomic, strong, readwrite) NSString *globalNotes;
    @property(nonatomic, strong, readwrite) NSString *globalUserCountry;
    

    And referred to them like so:

    self.globalNotes= @"Error (Marker 1010)";
    self.globalUserCountry= @"No result";
    

    That seemed to fix my problem.

提交回复
热议问题