当我使用 OneNote ://从我的ipad应用程序中打开OneNote时,它会打开OneNote,但是给出了一条错误消息:
无法打开链接“有一个问题与此链接在一个注。
这是我的密码
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"onenote://"]];PS:在尝试之前,Ipad的OneNote已经安装在Ipad设备上了。
这是OneNote - onenote://的正确URL方案吗? 还是我做错了。
错误消息确实会在关闭时产生问题,但我只想消除错误消息。也可以从我的应用程序中将参数传递给OneNote。
帮助欣赏!!
发布于 2015-04-21 14:43:46
使用" OneNote -cmd://“可以打开OneNote,不会出现任何错误。
发布于 2014-10-07 02:02:58
您收到错误的原因是,iOS OneNote客户端不支持由协议处理程序启动,而没有为笔记本、部分和页面(它不知道导航到哪里)的.If完成参数--您只是在使用onenote://而没有指定目的地,“通过设计”才会收到错误。
我们建议您在从应用程序中打开OneNote时链接到特定页面,以避免出现错误。OneNote REST返回一个链接到您在创建页面时创建的页面,您还可以使用iOS应用程序中的“复制链接到页面”函数检索链接。
发布于 2014-10-24 14:51:05
正如尼克指出的,OneNote应用程序需要额外的参数才能成功打开,而不显示“无法打开链接”警报。以下是我为解决这个问题所做的工作:
注意:在我的应用程序中,用户已经使用LiveSDK (Microsoft )登录,所以我保存了他们的访问令牌.
我创建了一个“授权OneNote”方法,该方法向OneNote API发送请求,以便在用户的默认笔记本中创建“页面”:
(void)AuthorizeOneNote
{
NSString *date = [NSString stringWithFormat:@"%@", [NSDate date]];
NSString *simpleHtml = [NSString stringWithFormat:
@"<html>"
"<head>"
"<title>\"%@\"</title>"
"<meta name=\"created\" content=\"%@\" />"
"</head>"
"<body>"
"<p></p>"
"</body>"
"</html>", @"Page Title", date];
NSData *presentation = [simpleHtml dataUsingEncoding:NSUTF8StringEncoding];
NSString *endpointToRequest = @"https://www.onenote.com/api/v1.0/pages";
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:endpointToRequest]];
request.HTTPMethod = @"POST";
request.HTTPBody = presentation;
[request addValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
[request setValue:[@"Bearer " stringByAppendingString:@"LIVE-ID-ACCESS-TOKEN"] forHTTPHeaderField:@"Authorization"];
objConnectionOneNote = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
}我是这样处理答复的:
(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
if (connection == objConnectionOneNote)
{
NSString *strData = [[NSString alloc]initWithData:objData encoding:NSUTF8StringEncoding];
NSMutableDictionary *dictData1 = [[NSMutableDictionary alloc] init];
dictData1 = [NSJSONSerialization JSONObjectWithData:objData options:kNilOptions error:nil];
oneNoteClientUrl = [dictData1 valueForKeyPath:@"links.oneNoteClientUrl.href"];
NSLog(@"Response: %@",oneNoteClientUrl);
NSLog(@"Response: %@",strData);
// Launch OneNote Client
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"onenote://"]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:oneNoteClientUrl]];
}
else
{
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"https://itunes.apple.com/us/app/microsoft-onenote-for-iphone/id410395246?mt=8&uo=4"]];
}
}这里有几件事要注意:
希望能帮上忙!
https://stackoverflow.com/questions/26218889
复制相似问题