fix: url components and import
This commit is contained in:
parent
f3aaba8db8
commit
e72038e136
|
|
@ -2,7 +2,7 @@
|
||||||
#import <OpenGLES/EAGL.h>
|
#import <OpenGLES/EAGL.h>
|
||||||
#import <OpenGLES/ES3/gl.h>
|
#import <OpenGLES/ES3/gl.h>
|
||||||
#import <QuartzCore/CADisplayLink.h>
|
#import <QuartzCore/CADisplayLink.h>
|
||||||
#include <QuartzCore/CAFrameRateRange.h>
|
#import <QuartzCore/CAFrameRateRange.h>
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
|
@ -524,11 +524,25 @@ void *ios_get_proc_address(const char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ios_open_url(const char *url) {
|
void ios_open_url(const char *url) {
|
||||||
NSString *nsurlString = [NSString stringWithUTF8String:url];
|
if (!url) {
|
||||||
NSURL *nsurl = [NSURL URLWithString:nsurlString];
|
NSLog(@"[raylib][IOS] invalid URL: null");
|
||||||
if (nsurl != nil) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSURLComponents *components = [NSURLComponents
|
||||||
|
componentsWithString:[NSString stringWithUTF8String:url]];
|
||||||
|
|
||||||
|
if (components == nil || components.scheme == nil) {
|
||||||
|
|
||||||
|
NSLog(@"[raylib][IOS] invalid URL: %s, Scheme: %s", url,
|
||||||
|
components ? components.scheme.UTF8String : "nil");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (components.URL != nil) {
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[UIApplication sharedApplication] openURL:nsurl
|
[[UIApplication sharedApplication] openURL:components.URL
|
||||||
options:@{}
|
options:@{}
|
||||||
completionHandler:nil];
|
completionHandler:nil];
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user