为什么一个系留的firemonkey应用程序不能工作PC-> Mac或PC-> ios(但工作PC-> PC和Mac-> ios)?

时间:2016-02-27 05:46:46

标签: ios macos delphi tethering

问题:我在Delphi XE10中创建的任何系留应用程序仅在两个应用程序在同一台计算机(PC或Mac)或Mac / ios配对上运行时才有效。 PC / mac和PC / ios失败。我已经尝试了RAD Studio XE10附带的MediaPlayer示例(在C:\ Users \ Public \ Documents \ Embarcadero \ Studio \ 17.0 \ Samples \ Object Pascal \ Multi-Device Samples \ Device Sensors and Services \ App Tethering)and it无法以相同的方式连接(与PC / Mac和PC / ios失败)。由于PC似乎是常见的因素,我认为这可能是一个防火墙问题,但没有什么看起来不合适,我甚至尝试了防火墙关闭,它仍然没有工作)

对于一些实际的代码,我将使用教程中的示例,该示例也以同样的方式对我失败:(可用教程:http://www.malcolmgroves.com/blog/?p=1854

  • 从两个多设备(firemonkey)应用程序(app1和app2)开始 - 在Delphi XE10的单独实例中创建每个应用程序
  • 在两者中,放入TetheringManager和TetheringAppProfile。
  • 在两者中,选择TetheringManager作为TetheringAppProfile中的管理器
  • 在App1中放入一个按钮和一个标签
  • 在App2中放入标签
  • 在App2中将TetheringManager的密码设置为无翼鸽子保护其巢穴

App1代码:

procedure TForm1.Button1Click(Sender: TObject);  
begin  
  TetheringManager1.AutoConnect();  
end;

procedure TForm1.FormCreate(Sender: TObject);  
begin   
  Caption := format('App1 : %s', [tetheringmanager1.Identifier]);  
end;

procedure TForm1.TetheringManager1PairedToRemote(const Sender: TObject; const AManagerInfo: TTetheringManagerInfo);  
begin  
  label1.Text := Format('Connected : %s %s', [amanagerinfo.ManagerIdentifier, amanagerinfo.ManagerName]);  
end;

procedure TForm1.TetheringManager1RequestManagerPassword(const Sender: TObject; const ARemoteIdentifier: string; var Password: string);  
begin  
  Password := 'The wingless dove protects its nest';  
end;

App2代码:

procedure TForm1.FormCreate(Sender: TObject);  
begin  
  caption := format('App2 : %s', [tetheringmanager1.Identifier]);  
end;

procedure TForm1.TetheringManager1PairedFromLocal(const Sender: TObject; const AManagerInfo: TTetheringManagerInfo);  
begin  
  label1.Text := Format('Connected : %s %s', [amanagerinfo.ManagerIdentifier, amanagerinfo.ManagerName]);  
end;

编译/构建/部署时,行为会因目标而异,如上所述并在下面列出。

+---------------------------+  
| App1  | App2  |  Outcome  |  
+-------+-------+-----------+  
|  PC1  |  PC1  |   success |
+-------+-------+-----------+  
|  PC1  |  Mac  | Failure   |
+-------+-------+-----------+  
|  PC1  |  ios  | Failure   |
+-------+-------+-----------+  
|  ios  |  PC1  | Failure   |
+-------+-------+-----------+  
|  ios  |  Mac  | Failure   |
+-------+-------+-----------+  
|  Mac  |  ios  |   Success |
+-------+-------+-----------+  
|  Mac  |  Mac  |   Success |
+-------+-------+-----------+  
|  Mac  |  PC1  | Failure   |
+-------+-------+-----------+  
|  PC1  |  PC2  | Failure   |
+-------+-------+-----------+  
|  PC2  |  PC2  |   Success |
+-------+-------+-----------+  

1 个答案:

答案 0 :(得分:0)

我长时间遇到同样的问题,直到今天还要与它斗争,所有我要做的就是创建入站和放大器。防火墙中的出站规则(控制面板\系统和安全\ Windows防火墙\高级设置)并设置程序文件的路径并打开所有端口允许所有连接类型,我得到了它。