Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RNSVGTopAlignedLabel" #1606

Closed
Nesh108 opened this issue Jun 24, 2021 · 2 comments

Comments

@Nesh108
Copy link

Nesh108 commented Jun 24, 2021

I have updated the library to 12.1.1 and after unlinking/linking again, I get this error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RNSVGTopAlignedLabel", referenced from:
      objc-class-ref in libRNSVG.a(RNSVGTSpan.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried cleaning the build folder but still nothing.

What should I do?
Adding that file in Xcode brings up even more errors.

EDIT: If I add all the non-added files of the apple folder, I get this:

MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.h:11:35: error: cannot find interface declaration for 'UILabel', superclass of 'RNSVGTopAlignedLabel'
@interface RNSVGTopAlignedLabel : UILabel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:5:4: error: expected a type
- (NSAttributedString *)attributedText
   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:10:4: error: expected a type
- (NSLineBreakMode)lineBreakMode
   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:15:4: error: expected a type
- (NSInteger)numberOfLines
   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:20:4: error: expected a type
- (NSString *)text
   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:25:4: error: expected a type
- (NSTextAlignment)textAlignment
   ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:30:28: error: expected a type
- (void)setAttributedText:(NSAttributedString *)attributedString
                           ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:35:27: error: expected a type
- (void)setLineBreakMode:(NSLineBreakMode)lineBreakMode
                          ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:40:27: error: expected a type
- (void)setNumberOfLines:(NSInteger)numberOfLines
                          ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:45:18: error: expected a type
- (void)setText:(NSString *)text
                 ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:50:27: error: expected a type
- (void)setTextAlignment:(NSTextAlignment)textAlignment
                          ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:7:17: error: property 'attributedString' not found on object of type 'RNSVGTopAlignedLabel *'
    return self.attributedString;
                ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:12:17: error: property 'textContainer' not found on object of type 'RNSVGTopAlignedLabel *'
    return self.textContainer.lineBreakMode;
                ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:17:17: error: property 'textContainer' not found on object of type 'RNSVGTopAlignedLabel *'
    return self.textContainer.maximumNumberOfLines;
                ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:22:17: error: property 'string' not found on object of type 'RNSVGTopAlignedLabel *'
    return self.string;
                ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:27:17: error: property 'alignment' not found on object of type 'RNSVGTopAlignedLabel *'
    return self.alignment;
                ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:32:11: error: property 'textStorage' not found on object of type 'RNSVGTopAlignedLabel *'
    [self.textStorage setAttributedString:attributedString];
          ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:37:10: error: property 'textContainer' not found on object of type 'RNSVGTopAlignedLabel *'
    self.textContainer.lineBreakMode = lineBreakMode;
         ^
MY_DIR/node_modules/react-native-svg/apple/Text/RNSVGTopAlignedLabel.macos.m:42:10: error: property 'textContainer' not found on object of type 'RNSVGTopAlignedLabel *'
    self.textContainer.maximumNumberOfLines = numberOfLines;
@Nesh108
Copy link
Author

Nesh108 commented Jun 28, 2021

Turns out that if i add #import <UIKit/UIKit.h> in RNSVGTopAlignedLabel.h and remove RNSVGTopAlignedLabel.macos.m from my project, everything builds.

Here is the full file:

#if TARGET_OS_OSX
#import <React/RCTTextView.h>
@interface RNSVGTopAlignedLabel : NSTextView

@property NSAttributedString *attributedText;
@property NSLineBreakMode lineBreakMode;
@property NSInteger numberOfLines;
@property NSString *text;
@property NSTextAlignment textAlignment;
#else
#import <UIKit/UIKit.h>
@interface RNSVGTopAlignedLabel : UILabel
#endif
@end

@bohdanprog
Copy link
Member

Hello @Nesh108,
I believe the issue has already been resolved. If you are still experiencing problems, please feel free to open a new one.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants