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 写的Target_NoTargetAction 就调用不了哟 #54

Open
wangkeshuai opened this issue Sep 3, 2019 · 4 comments
Open

用swift 写的Target_NoTargetAction 就调用不了哟 #54

wangkeshuai opened this issue Sep 3, 2019 · 4 comments

Comments

@wangkeshuai
Copy link

wangkeshuai commented Sep 3, 2019

  • (void)NoTargetActionResponseWithTargetString:(NSString *)targetString selectorString:(NSString *)selectorString originParams:(NSDictionary *)originParams
    {
    SEL action = NSSelectorFromString(@"Action_response:");
    NSObject *target = [[NSClassFromString(@"Target_NoTargetAction") alloc] init];

    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    params[@"originParams"] = originParams;
    params[@"targetString"] = targetString;
    params[@"selectorString"] = selectorString;

    [self safePerformAction:action target:target params:params];
    }

用swift 写的Target_NoTargetAction 就调用不了哟

@wangkeshuai wangkeshuai changed the title 用swift 写的Target_NoTargetAction 就调研不了哟 用swift 写的Target_NoTargetAction 就调用不了哟 Sep 3, 2019
@casatwy
Copy link
Owner

casatwy commented Jan 16, 2020

无法复现?

@Resoulte
Copy link

@wangkeshuai 怎么解决的啊

@IsLuoYe
Copy link

IsLuoYe commented Nov 18, 2022

因为在swift里使用NSClassFromString需要加上项目名:NSClassFromString("(workName).(className)")
我的解决方办法是:swift和OC进行混编,Target_NoTargetAction用OC写,然后在OC的代码里再进行一次跳转。

`
#import "Target_NoTargetAction.h"
#import <CTMediator.h>

@implementation Target_NoTargetAction

-(void)Action_response:(NSDictionary *)params{
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:params];
dic[kCTMediatorParamsKeySwiftTargetModuleName] = @"workName";
[[CTMediator sharedInstance] performTarget:@"Target" action:@"action" params:dic shouldCacheTarget:NO];
}

@EnD
`

@wangkeshuai
Copy link
Author

wangkeshuai commented Nov 18, 2022 via email

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

4 participants