AspectPatch无法调用
semnyqu opened this issue · comments
#import "XAAppDelegate.h"
#import "XAspect.h"
#define AtAspect AnalyticsAppDelegate
#define AtAspectOfClass XAAppDelegate
@classPatchField(XAAppDelegate)
AspectPatch(-, BOOL, application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions)
{
NSLog(@"成功加载友盟统计");
return XAMessageForward(application:application didFinishLaunchingWithOptions:launchOptions);
}
@EnD
#undef AtAspectOfClass
#undef AtAspect
debug中,没有进入AspectPatch的代码块中,"成功加载友盟统计"日志未打印
@xareelee 这个库非常好用,比Aspects方便,但是有个小问题
在podfile里面使用use_frameworks!会出现上面的情况;建议兼容源码模式和frameworks模式;
@semnyqu 你好,請問你原本的問題解決了嗎?
看了你的代碼,一些大小寫的部份是否有打錯?
@EnD
如果你只有在 Debug 下沒有打印,那先檢查下 Xcode project 設定,你該份文件是否有在 Debug 模式下編譯?
XAspect 的特點,就是可以完全去耦合,也就是不用變更原本項目中任何代碼,只要新增 aspect 文件(或移除),就能動態插入代碼。所以你該份文件若沒加入編譯範圍內,編譯是不會出錯發現問題,而導致你這個問題。
我先關閉這個 issue,若有新的問題再提出。
做过多种尝试,不支持use_frameworks, 如果使用非use_frameworks,会导致部分第三方UI库异常;