我想知道"组织标识符"你必须提供,或者通过连接"产品名称"自动创建。和"公司名称"
通过简短的搜索,我发现组织标识符用于识别您的应用。
我的问题如下:
com
用于标识下一个单词是否描述公司?这与域名表示有关,例如org
,net
等吗?答案 0 :(得分:1)
组织标识符必须是唯一的。通常,开发人员的网站是反向DNS表示法。也就是说,如果开发人员的网站是import java.io.*;
import java.net.*;
import java.util.*;
public class SynchClient
{
public static void main(String[] args) throws IOException
{
InetAddress host = null;
final int PORT = 1234;
Socket socket;
Scanner networkInput,keyboard;
PrintWriter output;
try
{
host = InetAddress.getLocalHost();
}
catch(UnknownHostException uhEx)
{
System.out.println("\nHost ID not found!\n");
}
socket = new Socket(host, PORT);
networkInput = new Scanner(socket.getInputStream());
output = new PrintWriter(socket.getOutputStream(),true);
keyboard = new Scanner(System.in);
String message, response;
do
{
System.out.print("\nEnter message ('QUIT' to exit): ");
message = keyboard.nextLine();
if (message.length() < 4)
{
System.out.print("\nPlease enter a value greater than 4 characters: ");
message = keyboard.nextLine();
}
output.println(message);
if (!message.equals("QUIT"))
{
response = networkInput.nextLine();
System.out.println("\n" + response);
}
}while (!message.equals("QUIT"));
try
{
System.out.println("\nClosing down connection...\n");
socket.close();
}
catch(IOException ioEx)
{
System.out.println("\n* Disconnection problem! *\n");
}
}
}
,那么组织标识符将变为public class SynchServer
{
public static void main(String[] args) throws IOException
{
ServerSocket serverSocket = null;
final int PORT = 1234;
Socket client;
ClientHandler handler;
try
{
serverSocket = new ServerSocket(PORT);
}
catch (IOException ioEx)
{
System.out.println("\nUnable to set up port!");
System.exit(1);
}
System.out.println("\nServer running...\n");
do
{
//Wait for client.
client = serverSocket.accept();
System.out.println("\nNew client accepted.\n");
handler = new ClientHandler(client);
handler.start();
}while (true);
}
}
class ClientHandler extends Thread
{
private Socket client;
private Scanner input;
private PrintWriter output;
private static String text = "";
public ClientHandler(Socket socket) throws IOException
{
client = socket;
input = new Scanner(client.getInputStream());
output = new PrintWriter(client.getOutputStream(),true);
}
public void run()
{
String head, tail, received;
received = input.nextLine();
// create head and tail in case first input is rep: or app:
head = received.substring(0, 4);
tail = received.substring(4);
while (!received.equals("QUIT"))
{
if (head.equals("rep:"))
{
changeText(tail);
output.println(text);
// input for next one
}
else
if (head.equals("app:"))
{
appendText(tail);
output.println(text);
// get input for next
}
else
{
//must be some random thing that just needs to be echoed
output.println(text);
}
//Get next input
received = input.nextLine();
//and set the head and tail again
head = received.substring(0, 4);
tail = received.substring(4);
}
try
{
System.out.println("Closing down connection...");
client.close();
}
catch(IOException ioEx)
{
System.out.println("* Disconnection problem! *");
}
}
private synchronized void changeText(String changedText)
{
text = changedText;
}
private synchronized void appendText(String appendedText)
{
text += appendedText;
}
}
。
根据Apple的说法,这个捆绑标识符在App Store上的应用程序中应该是唯一的(如果你想在Apple的App Store上分发你的应用程序)。因此,确保这种唯一性的一种方法是选择一个唯一的组织标识符。
创建应用程序的两个版本(iOS,macOS),标识符也需要不同,一种方法是在标识符字段中的应用程序名称之前附加public class SynchClient
{
public static void main(String[] args) throws IOException
{
InetAddress host = null;
final int PORT = 1234;
Socket socket;
Scanner networkInput,keyboard;
PrintWriter output;
try
{
host = InetAddress.getLocalHost();
}
catch(UnknownHostException uhEx)
{
System.out.println("\nHost ID not found!\n");
}
socket = new Socket(host, PORT);
networkInput = new Scanner(socket.getInputStream());
output = new PrintWriter(socket.getOutputStream(),true);
keyboard = new Scanner(System.in);
String message, response;
do
{
System.out.print("\nEnter message ('QUIT' to exit): ");
message = keyboard.nextLine();
while (message.length() < 4)
{
System.out.print("\nPlease enter 4 or more characters: ");
message = keyboard.nextLine();
}
output.println(message);
if (!message.equals("QUIT"))
{
response = networkInput.nextLine();
System.out.println("\n" + response);
}
}while (!message.equals("QUIT"));
try
{
System.out.println("\nClosing down connection...\n");
socket.close();
}
catch(IOException ioEx)
{
System.out.println("\n* Disconnection problem! *\n");
}
}
}
或example.com
。 / p>
将应用程序分发到App Store后,无法更改标识符。
最后,对于最后一个问题,我看不出这部分有任何问题。选择一个好的,独特的,漂亮的组织标识符已经足够了。
<强>参考强>