XAspect 使用error

****** XAspect Assertion Failed ******app

--------------------------------------.net

** Condition: succeedget

** Reason: **Failure: Safe category method injection failed.it

**Reason: the implementation already exists.io

 

Ture:class

#import "AppDelegate.h"import

#import <XAspect/XAspect.h>後臺

#import "EMSDK.h"im

#define AtAspect  EMdi

#define AtAspectOfClass AppDelegate

@classPatchField(AppDelegate)

AspectPatch(-, void, applicationDidEnterBackground:(UIApplication *)application )

{// APP進入後臺

    [[EMClient sharedClient] applicationDidEnterBackground:application];

    return XAMessageForward(applicationDidEnterBackground:application );

}

AspectPatch(-, void, applicationWillEnterForeground:(UIApplication *)application )

{    // APP將要從後臺返回

    [[EMClient sharedClient] applicationWillEnterForeground:application];

    return XAMessageForward(applicationWillEnterForeground:application );

}

@end

#undef AtAspectOfClass

#undef AtAspect

 

False:

#import "AppDelegate.h"

#import <XAspect/XAspect.h>

#import "EMSDK.h"

#define AtAspect  EM

#define AtAspectOfClass AppDelegate

@classPatchField(AppDelegate)

// APP進入後臺
- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [[EMClient sharedClient] applicationDidEnterBackground:application];
}
 
// APP將要從後臺返回
- (void)applicationWillEnterForeground:(UIApplication *)application
{
    [[EMClient sharedClient] applicationWillEnterForeground:application];
}

@end

#undef AtAspectOfClass

#undef AtAspect

相關文章
相關標籤/搜索