当我在运行时使用 objc_msgSend 时,为什么?

When I use objc_msgSend in runtime, why?

这很好
return [[DJLocalizationSystem shared] localizedStringForKey:(key) value: @"" table: nil bundle:bundle];
但是,这不起作用
return objc_msgSend([DJLocalizationSystem shared], @selector(localizedStringForKey:value:table:bundle:),(key),@"",nil,bundle);
和方法 returns 一个字符串值。

EXC_BAD_ACCESS,代码=1,地址=0x8
有一个类似的问题 Whosebug,但我认为 none 的答案是正确的。它与 0x8 无关。

objc_msgSend 在 32 位 iPhone 和模拟器中工作正常,但在 64 iPhone 中,您必须指出类型。所以我的代码是
NSString *(*action)(id, SEL, NSString *, NSString *, NSString *, NSBundle *) = (NSString * (*) (id, SEL, NSString *, NSString *, NSString *, NSBundle *) ) objc_msgSend; action(system, @selector(localizedStringForKey:value:table:bundle:), (key), @"", nil, [NSBundle bundleForActionCamera]);