forked from holzschu/ios_system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openurl.m
30 lines (22 loc) · 654 Bytes
/
openurl.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// openurl.m
// ios_system
//
// Created by Nicolas Holzschuch on 11/01/2019.
// Copyright © 2019 Nicolas Holzschuch. All rights reserved.
//
#include <stdio.h>
#include "ios_system/ios_system.h"
#include "ios_error.h"
#import <Foundation/Foundation.h>
int openurl_main(int argc, char *argv[]) {
optind = 1;
NSString *usage = @"Usage: openurl url";
if (argc < 2) {
printf("%s\n", usage.UTF8String);
return -1;
}
NSURL *locationURL = [NSURL URLWithString:@(argv[1])];
[[UIApplication sharedApplication] openURL:locationURL options:@{} completionHandler:nil];
return 0;
}