앱 스키마 URL - aeb seukima URL

About Apple URL Schemes This document describes several URL schemes that are supported by system apps on iOS, macOS, and watchOS 2 and later. Native iOS apps and web apps running in Safari on any platform can use these schemes to integrate with system apps

URL Scheme이란? IOS에서 어플리케이션 간 통신을 하는 방법이다. URL scheme을 통해서 데이터를 전달하고 실행시킬 수 있다. 어플리케이션마다 지원할 수도 있고 아닐 수도 있다. 여러 기능들까지 지

gofo-coding.tistory.com

 

URL Scheme 목록 확인하기

게시글 바로가기(클릭)

 

URL Scheme 목록

목차 URL Scheme 목록 URL Scheme 목록 앱에서 url scheme을 지원하지 않을 경우 대처방법 URL Scheme 추가요청 * 참고) URL Scheme이란? 게시글(클릭)  URL Scheme URL Scheme이란? IOS에서 어플리케이션 간 통..

gofo-coding.tistory.com

 

단축어 이용해서 어플 실행시키기

게시글 바로가기(클릭)

 

단축어로 다른 어플 실행하기(URL Scheme 이용)

어플리케이션에서 URL scheme을 지원하지 않거나, URL scheme을 알아내기 어려운 경우에는 url로 어플을 실행하지 못할까요? 아닙니다! iOS 기본 어플리케이션인 단축어 앱을 이용하면 어떤 앱이든 실

application:willFinishLaunchingWithOptions:와 application:didFinishLaunchingWithOptions: 메소드는 URL에 대한 정보를 검색하고 URL 열기 여부를 결정하는 메소드이다. 두 메소드 중 하나가 NO를 반환하면 앱의 URL 처리 코드가 호출되지 않는다.

  • application:openURL:sourceApplication:annotation: 메서드를 사용하여 파일을 연다.

  • URL 요청이 도착했을 때 앱이 실행 중이 아니면 앱이 시작되고 URL을 열 수 있도록 foreground로 이동한다. application:willFinishLaunchingWithOptions: 이나 application:didFinishLaunchingWithOptions:
    메소드의 구현은 options dictionary에서 URL을 검색하고 앱이 URL을 열 수 있는 지 여부를 결정해야한다. 가능한 경우 YES를 반환하고, app에 openURL:sourceApplication :annotation : (또는 appication:handleOpenURL)메서드를 사용하여 실제 URL 열기를 처리하도록한다. 두 가지 방법을 모두 구현하는 경우 URL을 열기 전에 둘 다 YES를 반환해야한다.

  • 앱 스키마 URL - aeb seukima URL

    • URL 요청이 도착하면 앱이 실행중이지만 background에 있거나 일시중지된 경우 URL이 열리기 위해 foreground로 이동된다. 잠시 후 시스템은 delegate의 application:openURL:sourceApplication:annotation: 메서드를 URL을 확인하고 열기위해 호출한다. 아래 그림은 app을 foreground로 이동하여 URL을 여는 프로세스를 보여준다.

    앱 스키마 URL - aeb seukima URL

    Note: custom URL schemes을 지원하는 app은 URL을 처리하기 위해 app을 실행할 때 표시할 다른 시작이미지를 지정할 수 있다. 이러한 시작 이미지를 지정하는 방법에 대한 자세한 내용은 Displaying a Custom Launch Image When a URL is Opened
    에 나와있다.

    Handling a URL request based on a custom scheme

    OBJECTIVE-C

    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
        if ([[url scheme] isEqualToString:@"todolist"]) {
            ToDoItem *item = [[ToDoItem alloc] init];
            NSString *taskName = [url query];
            if (!taskName || ![self isValidTaskString:taskName]) { // must have a task name
                return NO;
            }
            taskName = [taskName stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
     
            item.toDoTask = taskName;
            NSString *dateString = [url fragment];
            if (!dateString || [dateString isEqualToString:@"today"]) {
                item.dateDue = [NSDate date];
            } else {
                if (![self isValidDateString:dateString]) {
                    return NO;
                }
                // format: yyyymmddhhmm (24-hour clock)
                NSString *curStr = [dateString substringWithRange:NSMakeRange(0, 4)];
                NSInteger yeardigit = [curStr integerValue];
                curStr = [dateString substringWithRange:NSMakeRange(4, 2)];
                NSInteger monthdigit = [curStr integerValue];
                curStr = [dateString substringWithRange:NSMakeRange(6, 2)];
                NSInteger daydigit = [curStr integerValue];
                curStr = [dateString substringWithRange:NSMakeRange(8, 2)];
                NSInteger hourdigit = [curStr integerValue];
                curStr = [dateString substringWithRange:NSMakeRange(10, 2)];
                NSInteger minutedigit = [curStr integerValue];
     
                NSDateComponents *dateComps = [[NSDateComponents alloc] init];
                [dateComps setYear:yeardigit];
                [dateComps setMonth:monthdigit];
                [dateComps setDay:daydigit];
                [dateComps setHour:hourdigit];
                [dateComps setMinute:minutedigit];
                NSCalendar *calendar = [s[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
                NSDate *itemDate = [calendar dateFromComponents:dateComps];
                if (!itemDate) {
                    return NO;
                }
                item.dateDue = itemDate;
            }
     
            [(NSMutableArray *)self.list addObject:item];
            return YES;
        }
        return NO;
    }
    Displaying a Custom Launch Image When a URL is Opened
    • custom URL schemes를 지원하는 앱은 각 scheme에 custom 시작 이미지를 설정할 수 있다.
      시스템이 URL을 처리하기 위해 앱을 실행하고 관련 스냅 샷을 사용할 수없는 경우 지정한 시작 이미지를 표시한다. 시작 이미지를 지정하려면 다음 이름 지정 규칙을 사용하는 이름의 PNG 이미지를 제공해야한다.
      • <basename>-<url_scheme><other_modifiers>.png
    • 위의 명명규칙에서 basename은 앱의 info.plist 파일에 있는 UILaunchImageFile 키로 지정된 기본 이미지 이름을 나타낸다. 사용자 정의 기본 이름을 지정하지 않으면 기본값인 문자열을 사용하여야한다. 이름의부분은 URL 스키마 이름이다. myapp URL 체계에 대한 일반 시작 이미지를 지정하려면 app bundle에 [email protected]라는 이름의 이미지 파일을 포함시켜야한다. (@ 2x 수정자는 이미지가 망막 디스플레이를 위한 것임을 나타내며, 앱이 표준 해상도 디스플레이도 지원하는 경우 Default-myapp.png 이미지도 제공한다.)