有没有人想出如何检测到Google Chrome已安装,然后从您自己的应用中打开它,并在iOS 9中将链接传递给它?
我过去常常使用根据OpenInChromeController建议的Google方法。似乎Google没有为iOS 9更新该文档,OpenInChromeController似乎被放弃了。
答案 0 :(得分:4)
我认为更详细的答案是将以下三个方案添加到LSApplicationQueriesSchemes
中的YOURAPP-Info.plist
有关详细信息,请参阅Cocoapods
答案 1 :(得分:1)
我想出来了,你只需要将它作为LSApplicationQueriesSchemes添加到plist中,然后你就可以使用canOpenUrl来查看是否安装了应用程序
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace xxxx
{
public partial class Main : Form
{
//Path of the respective folder
string mainFolder = "C:\\xxx\\xxx\\";
string fileDateTime = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
public Main()
{
InitializeComponent();
this.textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);
this.textBox2.KeyPress += new KeyPressEventHandler(textBox2_KeyPress);
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
//'Limit to 8 Numbers
e.Handled = !(char.IsDigit(e.KeyChar) || e.KeyChar == 8);
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
//'Limit to 16 alphanumeric characters
e.Handled = !(char.IsLetter(e.KeyChar) || e.KeyChar == 8) && !(char.IsDigit(e.KeyChar) || e.KeyChar == 8);
}
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBox1.Text))
{
//'Error Message
MessageBox.Show("xxx ID cannot be empty!");
}
else if (string.IsNullOrEmpty(textBox2.Text))
{
//'Error Message
MessageBox.Show("xxx No cannot be Empty!");
}
else
{
//'Start the .exe file to generate readings
ProcessStartInfo DMM = new ProcessStartInfo("BasicFunctions.exe");
DMM.UseShellExecute = false;
DMM.RedirectStandardOutput = true;
DMM.CreateNoWindow = true;
var proc = Process.Start(DMM);
//'Read value from the console output
string value = proc.StandardOutput.ReadToEnd();
//'Redirect console output to richtextbox
richTextBox1.Text = value;
//'Read selected voltage values from richtextbox
string selectedvalue = richTextBox1.SelectedText;
richTextBox1.SelectionStart = 100;
richTextBox1.SelectionLength = 1000;
//'Check for xxx folder existence and create it if not
System.IO.Directory.CreateDirectory(mainFolder);
//'Append richtextbox input to logfile
using (StreamWriter writer = new StreamWriter(mainFolder + textBox2.Text + ".txt", true))
{
//File.WriteAllText(textBox2.Text, "\r\n" + richTextBox1.Text);
writer.Write(label2.Text + " " + textBox1.Text + "\r\n" + "Date/Time: " + fileDateTime + "\r\n" + richTextBox1.Text + "\r\n");
}
//'Condition for Pass/Fail
if ((selectedvalue == "0.0005") || (selectedvalue == "0.0006") || (selectedvalue == "0.0007") || (selectedvalue == "0.0008") || (selectedvalue == "0.0009") || (selectedvalue == "0.0010") || (selectedvalue == "0.0011") || (selectedvalue == "0.0012") || (selectedvalue == "0.0013") || (selectedvalue == "+1.5"))
{
label4.Visible = true;
}
else
{
label5.Visible = true;
}
}
/*Send code status to xxx
*
if (label4.Visible == true)
{
string args = (textBox1.Text + "x" + textBox2.Text + "xxx");
Process.Start("cmd.exe", "/c xxx.exe " + args + " && pause");
}
else if (label5.Visible == true)
{
string args = (textBox1.Text + "x" + textBox2.Text + "xxx");
Process.Start("cmd.exe", "/c xxx.exe " + args + " && pause");
}
else
{
MessageBox.Show("Sending to xxx Server has failed, please try again", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
*/
}
private void Main_Load(object sender, EventArgs e)
{
//'Make Pass/Fail label invisible at start
label4.Visible = false;
label5.Visible = false;
//'Focus on Operator textbox
textBox1.Select();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("Sending to xxx has been turned on...", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("Sending to xxx has been turned off...", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}