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

Error: /Headers/NSBundle.h:91:143: error: function does not return NSString #45

Open
iamkhalidbashir opened this issue Jul 30, 2023 · 1 comment

Comments

@iamkhalidbashir
Copy link

I am recieving this error when building a wails app with -tags=desktop,production

In file included from /root/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/pkg/assetserver/webview/request_darwin.go:9:
In file included from /usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
                                                         ~~~~~~~~~~~~~~                                                                       ^                  ~
/usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
        #define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
                                                      ^          ~
In file included from /root/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/pkg/assetserver/webview/request_darwin.go:9:
In file included from /usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:130:
/usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:168: error: expected ')'
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
                                                                                                                                                                       ^
/usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:141: note: to match this '('
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
                                                                                                                                            ^
In file included from /root/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/pkg/assetserver/webview/request_darwin.go:10:
In file included from /usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WebKit.h:39:
In file included from /usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKFrameInfo.h:30:
/usr/local/osxcross/bin/../SDK/MacOSX12.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h:337:237: error: unknown type name '_Nullable_result'
- (void)callAsyncJavaScript:(NSString *)functionBody arguments:(nullable NSDictionary<NSString *, id> *)arguments inFrame:(nullable WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^ _Nullable)(_Nullable_result id, NSError * _Nullable error))completionHandler NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0));

When solutions I found is this:-
tpoechtrager/osxcross#345

Which requires me to set
CXXFLAGS=-DNS_FORMAT_ARGUMENT(A)=

But how to set this flag?

@troian
Copy link
Member

troian commented Jul 30, 2023

in a target for Darwin try set CGO_CXXFLAGS: "-DNS_FORMAT_ARGUMENT(A)=" in the env section

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