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

Loading .dylib has failed, This is likely because Swift code being injected references a function using a default argument or a member with access control that is too restrictive or perhaps an XCTest that depends on code not normally linked into your application. Rebuilding and re-running your project (without a build clean) can resolve this. #93

Closed
zerocc2014 opened this issue Apr 10, 2024 · 8 comments

Comments

@zerocc2014
Copy link

Loading .dylib has failed, This is likely because Swift code being injected references a function using a default argument or a member with access control that is too restrictive or perhaps an XCTest that depends on code not normally linked into your application. Rebuilding and re-running your project (without a build clean) can resolve this.

use HotReloading SPM in .xcworkspace cocopods project

@johnno1962
Copy link
Owner

Hi, Is this Swift or Objective-C? Can you tell me the name of the symbol that is not defined?

@zerocc2014
Copy link
Author

Hi, Is this Swift or Objective-C? Can you tell me the name of the symbol that is not defined?

my project Swift and Objective-C,symbol not found in flat namespace '_xxx';

`
typedef NSString *URLConstString;

extern a URLConstString xxx;

URLConstString const xxx = @"yyyyy";
`

@zerocc2014
Copy link
Author

Hi, Is this Swift or Objective-C? Can you tell me the name of the symbol that is not defined?

dlopen(/..path/tmp/eval101.dylib, 0x0002): symbol not found in flat namespace '_xxx'

@johnno1962
Copy link
Owner

Strange, can you remove the "const"?

@zerocc2014
Copy link
Author

Strange
above i write error,original like this
typedef NSString *URLConstString;

extern URLConstString const xxx;

URLConstString const xxx = @"yyyyy";

@johnno1962
Copy link
Owner

I'm not sure what the problem is. If you can't inject files that refer to this definition you could consider creating a class method to access the variable.

@zerocc2014
Copy link
Author

I'm not sure what the problem is. If you can't inject files that refer to this definition you could consider creating a class method to access the variable.

thx, I use demo test inject success,but company project is fail.

@johnno1962
Copy link
Owner

johnno1962 commented Apr 11, 2024

Not much more I can say here. When referring to a particular symbol gives you problems dynamically loading you have to explore ways to avoid referring to that symbol directly in the file being inject for example by using a class method.

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