IOS checks whether a url schemes is set in the Application

Source: Internet
Author: User

IOS checks whether a url schemes is set in the Application
Recently, another application A needs to jump to our B (with url schemes set) and then return to, when A is returned, A needs to set A url schemes to redirect B to. However, after A jumps to B, B finds that A has not passed its own url schemes. B is dumb. How can B go back, of course, there is no need to process the returned results after iOS9. For versions earlier than 9, before A jumps to B, it is necessary to determine whether A has set the corresponding url schemes, skip is not allowed if it is not set. But the question is, how can I determine if A has set url schemes? When I encountered this problem, the first reaction was to search for the answer from Google. However, if the problem was not well described, I could not find the answer. Finally, I asked stackoverflow, after a full afternoon, I could not find the answer. When I got up early today, I suddenly thought of the code I used to search for the current system version:

NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];NSString* versionNum =[infoDict objectForKey:@"CFBundleVersion"];NSString*appName =[infoDict objectForKey:@"CFBundleDisplayName"];NSString*text =[NSString stringWithFormat:@"%@ %@",appName,versionNum];

 

InfoDict seems to be the dictionary obtained from the configuration file of the entire program. What did I find?
<key>CFBundleURLTypes</key>    <array>        <dict>            <key>CFBundleTypeRole</key>            <string>Editor</string>            <key>CFBundleURLSchemes</key>            <array>                <string>aaa123</string>            </array>        </dict>    </array>

 

It contains the url schems set by myself in the application, which is then obtained directly to solve this problem. The solution to this problem gives me another way of thinking. When encountering a difficult problem, in addition to searching, we should also think about a solution by ourselves, even though it may be very painful, but you must try it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.