Hello !
I have to get the parameters passed in the deep link calling my app.
I found this Objective-C function, but of course when I try to include it in my code and compile, I get 250 compilation errors...
Objective-C is real brainfuck, and is totally illegible and incomprehensible for me.
Could you help me to run this code in B4i ?
Thanks !
I have to get the parameters passed in the deep link calling my app.
I found this Objective-C function, but of course when I try to include it in my code and compile, I get 250 compilation errors...
Objective-C is real brainfuck, and is totally illegible and incomprehensible for me.
Could you help me to run this code in B4i ?
Thanks !
Objective-C:
@end
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
if ([url.scheme isEqualToString:@"myapp"]) {
// Gérez l'URL personnalisée ici
NSDictionary *queryItems = [self parseQueryString:url.query];
NSString *param1 = queryItems[@"param1"];
NSString *param2 = queryItems[@"param2"];
// Utilisez param1 et param2 comme nécessaire
NSLog(@"Paramètre 1 : %@", param1);
NSLog(@"Paramètre 2 : %@", param2);
return YES;
}
return NO;
}
- (NSDictionary *)parseQueryString:(NSString *)query {
NSMutableDictionary *queryDict = [NSMutableDictionary dictionary];
NSArray *queryComponents = [query componentsSeparatedByString:@"&"];
for (NSString *component in queryComponents) {
NSArray *keyValue = [component componentsSeparatedByString:@"="];
if (keyValue.count == 2) {
NSString *key = keyValue[0];
NSString *value = keyValue[1];
queryDict[key] = [value stringByRemovingPercentEncoding];
}
}
return [queryDict copy];
}
@end