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

Swift下ivar_getTypeEncoding无法获取类型 #134

Open
KTechRick opened this issue Aug 10, 2023 · 2 comments
Open

Swift下ivar_getTypeEncoding无法获取类型 #134

KTechRick opened this issue Aug 10, 2023 · 2 comments

Comments

@KTechRick
Copy link

在用Swift实现的UIViewController子类里,使用ivar_getTypeEncoding无法获取属性类型,返回是空字串"", 某些情况还会返回NULL导致crash, 看来在swift下要另外寻找方案了

@dourgulf
Copy link

dourgulf commented Dec 6, 2023

看起来是Xcode15才有这个问题,并且,可以确定 URL 类型的属性,会返回 NULL,其他属性返回空字符串。

@xiakehc
Copy link

xiakehc commented Nov 21, 2024


*** fix

if(ivar && ivar != NULL && ivar_getTypeEncoding(ivar)!= NULL){
ivarType = @(ivar_getTypeEncoding(ivar));
}else{
NSLog(@"swift ViewController ivar or ivar_getTypeEncoding(ivar) NULL");
}

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

3 participants