URL Scheme
完整的:
scheme://user:password@host:port/path?query#fragment
简化的:
scheme://host/path?query
NSURL
NSURLComponents
@interface NSString (NSURLUtilities)
// Returns a new string made from the receiver by replacing all characters not in the allowedCharacters set with percent encoded characters. UTF-8 encoding is used to determine the correct percent encoded characters. Entire URL strings cannot be percent-encoded. This method is intended to percent-encode an URL component or subcomponent string, NOT the entire URL string. Any characters in allowedCharacters outside of the 7-bit ASCII range are ignored.
- (nullable NSString )stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet )allowedCharacters NS_AVAILABLE(10_9, 7_0);
// Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters.
@property (nullable, readonly, copy) NSString *stringByRemovingPercentEncoding NS_AVAILABLE(10_9, 7_0);
- (nullable NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc NS_DEPRECATED(10_0, 10_11, 2_0, 9_0, “Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.”);
- (nullable NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)enc NS_DEPRECATED(10_0, 10_11, 2_0, 9_0, “Use -stringByRemovingPercentEncoding instead, which always uses the recommended UTF-8 encoding.”);
@end
App 之间Comunication
设置
plist
发送
接受
refer
- http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
- https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html
Universal Links
设置
web
1 创建 apple-app-site-association 配置文件(没有后缀),文件内包含App可以处理的JSON格式URLs设置
2 上传 apple-app-site-association 文件至HTTPS服务器
3 App完成处理 universal links 编码
实例
{
“applinks”: {
“apps”: [],
“details”: [
{
“appID”: “9JA89QQLNQ.com.apple.wwdc”,
“paths”: [ “/wwdc/news/“, “/videos/wwdc/2015/“]
},
{
“appID”: “TeamID.BundleID2”,
“paths”: [ ““ ]
}
]
}
}
App
Add an entitlement that specifies the domains your app supports.
Update your app delegate to respond appropriately when it receives the NSUserActivity object.
NSUserActivityTypeBrowsingWeb
relation
HandOff
Core Spotlight