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.