μ¬λ³΄μΈμ!
λλ μ΄λ―Έ λͺ¨λ κ²μ μ€μ νκ³ μλ¦Όμ μλ²½νκ² μλν©λλ€.
urlμ΄ μλ μΌλ° λ©μμ§λ₯Ό 보λ΄κ³ μλ¦Όμ λλ₯΄λ©΄ λ΄κ° μνλ λͺ¨λ°μΌ μ±μ΄ μ€νλ©λλ€.
κ·Έλ¬λ μλ¦Όμ 보λ΄λ νλμ μ νΈ κ³μ μ ν¬λ‘¬ νμ₯ νλ‘κ·Έλ¨μμλ μ¬μ©λλ―λ‘ μλ¦Ό 맀κ°λ³μμ ꡬμ±λ μΉμ¬μ΄νΈ URLμ΄ μμ΅λλ€. λ°λΌμ λͺ¨λ°μΌμμ μ΄ μλ¦Όμ μμ νλ©΄ μΉμ¬μ΄νΈμ URLμ μ¬μ©νκ³ μμΌλ©° λͺ¨λ°μΌ μ±μ΄ μλ λΈλΌμ°μ λ₯Ό μ¬λ κ²μ λλ€.
URLμ 무μνλ λ°©λ²μ΄ μμ΅λκΉ?
μλλ©΄ μ μμ μΈ λμμ μ€μ§νκ³ μλμΌλ‘ λͺ¨λ°μΌ μ±μ μ¬μκ² μ΅λκΉ?
μλλ©΄ λ΄κ°μ΄ κ²°κ³Όλ₯Ό μ»κΈ° μν΄ λκ° μλͺ»νκ³ μμ΅λκΉ?
λμ μ£Όμ μ κ°μ¬ν©λλ€.
@jkasten2
@ccstorch @avishayil μ±μμ μ€ν URLμ λν λμμ λΉνμ±ννλ λ°©λ²μ΄ μμ΅λλ€. κ·νμ κ²½μ° 2κ°μ κ°λ³ μλ¦Όμ 보λ΄μΌ ν©λλ€. νλλ μμ URLμ΄ μ€μ λ Chrome νμ₯ νλ‘κ·Έλ¨μ λν κ²μ΄κ³ λ€λ₯Έ νλλ λͺ¨λ°μΌ μ±μ λν κ²μ λλ€.
λ¬Έμ μμ΅λλ€. @jkasten2λ₯Ό λμμ£Όμ μ κ°μ¬ν©λλ€!
OneSignalHelper
μ displayWebView :
λ©μλλ₯Ό νμ λ κ²λ μ΄ λ¬Έμ λ₯Ό ν΄κ²°νλ μ루μ
μ
λλ€. _νλ₯ν_ μ κ·Ό λ°©μμ μλμ§λ§ μμ
μ μλ£ν©λλ€(νμ¬λ‘μλ).
β οΈ μλ‘ λλμ΄ λλ κ²½μ°μλ§ μ΄ μμ μ μννμΈμ β οΈ
#import <RCTOneSignal/RCTOneSignal.h>
#import <objc/runtime.h>
<strong i="9">@implementation</strong> AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Don't do this unless in dire yolo situations
SwizzleClassMethod(NSClassFromString(@"OneSignalHelper"), @selector(displayWebView:), [AppDelegate class], @selector(displayWebView:));
NSString *oneSignalAPIID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ONE_SIGNAL_API_ID"];
self.oneSignal = [[RCTOneSignal alloc] initWithLaunchOptions:launchOptions appId:oneSignalAPIID];
return YES;
}
+ (void) displayWebView:(NSURL*)url {
NSLog(@"This is dumb");
}
void SwizzleClassMethod(Class cOriginal, SEL orig, Class cNew, SEL new) {
Method origMethod = class_getClassMethod(cOriginal, orig);
Method newMethod = class_getClassMethod(cNew, new);
cOriginal = object_getClass((id)cOriginal);
cNew = object_getClass((id)cNew);
if(class_addMethod(cOriginal, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(cNew, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
} else {
method_exchangeImplementations(origMethod, newMethod);
}
}
<strong i="10">@end</strong>