I set GCSupportsGameMode to true in MyApp's Info.plist, then GameMode is triggered.
After you set this value, Game Mode will not be triggered every time you launch the game. Instead, you must wait at least five minutes after the last time the App was closed before launching it again for Game Mode to be triggered.
Post
Replies
Boosts
Views
Activity
Reason:
This crash was caused by multiple threads accessing the lastHypothesis function of the UIDictationController, causing a wild pointer problem
Solution:
Lock the setLastHypothesis and lastHypothesis functions of UIDictationController,
// hd_hookMethod is hook components similar to aspect
[NSClassFromString(@"UIDictationController") hd_hookMethod:NSSelectorFromString(@"setLastHypothesis:") option:HDHookOptionInstead handle:^(HDInvocation *invocation){
[[invocation.target hdcore_lock] lock];
[invocation invoke];
[[invocation.target hdcore_lock] unlock];
} error:nil];
[NSClassFromString(@"UIDictationController") hd_hookMethod:NSSelectorFromString(@"lastHypothesis") option:HDHookOptionInstead handle:^NSString * (HDInvocation *invocation){
[[invocation.target hdcore_lock] lock];
__autoreleasing NSString *orgHypothesis;
[invocation invokeWithReturnValue:&orgHypothesis];
orgHypothesis = orgHypothesis.mutableCopy;
[[invocation.target hdcore_lock] unlock];
return orgHypothesis;
} error:nil];
The solution comes from the HuolalaTech team, I just translated it into English
Reference material:
https://juejin.cn/post/7396463744186515465
Reason:
This crash was caused by multiple threads accessing the lastHypothesis function of the UIDictationController, causing a wild pointer problem
Solution:
Lock the setLastHypothesis and lastHypothesis functions of UIDictationController,
// hd_hookMethod is hook components similar to aspect
[NSClassFromString(@"UIDictationController") hd_hookMethod:NSSelectorFromString(@"setLastHypothesis:") option:HDHookOptionInstead handle:^(HDInvocation *invocation){
[[invocation.target hdcore_lock] lock];
[invocation invoke];
[[invocation.target hdcore_lock] unlock];
} error:nil];
[NSClassFromString(@"UIDictationController") hd_hookMethod:NSSelectorFromString(@"lastHypothesis") option:HDHookOptionInstead handle:^NSString * (HDInvocation *invocation){
[[invocation.target hdcore_lock] lock];
__autoreleasing NSString *orgHypothesis;
[invocation invokeWithReturnValue:&orgHypothesis];
orgHypothesis = orgHypothesis.mutableCopy;
[[invocation.target hdcore_lock] unlock];
return orgHypothesis;
} error:nil];
The solution comes from the HuolalaTech team, I just translated it into English
Reference material:
https://juejin.cn/post/7396463744186515465