我在哪里可以获得 CN1 模拟器的 IPhone 11 皮肤?
Where can i get the IPhone 11 Skin for CN1 Simulator?
AppStore 现在需要 IPhone 11(或高 IPhone X)皮肤用于其 6.5 英寸元数据图像。请有人指出我的方向,以便在我的 Codenameone 模拟器中使用。
我正在安装最新版本 (CN1 v6),我的 .codenameone 文件夹中最多有 IPhoneX.skin,但我希望尽可能多地证明未来,所以选择 11。谢谢
我们还没有 iPhone 11 的皮肤,尽管您可以就那个 here 提交 RFE。但这对大多数人来说并不重要。
大多数人使用诸如此类的工具以可移植的方式生成屏幕截图:
我遇到了同样的问题。我使用不同的方法来获取一个或多个屏幕截图 根据商店的要求。简而言之,我在“Browser Stack App Live”(有多个真实设备,如所需的 iPhone 11) 上执行应用程序,使用以编程方式发送给我的代码使用 REST 请求的应用程序的一张或多张屏幕截图。
请注意,在 Browser Stack App Live 上无法发送电子邮件,因此我创建了自己的 REST API 用于屏幕截图上传。
很简单,我在分享之前测试了以下解决方案。在安装了 Apache + PHP 的临时 VPS 上,或者如果您有 public IP,则在本地计算机上创建以下内容 upload.php
,记得更新 $server_url
与你实际的 url:
<?php
header('Content-Type: application/json; charset=utf-8');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
$response = array();
$upload_dir = 'uploads/';
$server_url = 'https://www.example.com/mydir/';
if($_FILES['screenshot'])
{
$screenshot_name = $_FILES["screenshot"]["name"];
$screenshot_tmp_name = $_FILES["screenshot"]["tmp_name"];
$error = $_FILES["screenshot"]["error"];
if($error > 0){
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}else
{
$random_name = rand(1000,1000000)."-".$screenshot_name;
$upload_name = $upload_dir.strtolower($random_name);
$upload_name = preg_replace('/\s+/', '-', $upload_name);
if(move_uploaded_file($screenshot_tmp_name , $upload_name)) {
$response = array(
"status" => "success",
"error" => false,
"message" => "File uploaded successfully",
"url" => $server_url."/".$upload_name
);
}else
{
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}
}
}else{
$response = array(
"status" => "error",
"error" => true,
"message" => "No file was sent!"
);
}
echo json_encode($response);
?>
之后,mkdir uploads
和 chown
相应地 php 文件和上传目录的权限。
服务器已准备就绪。
在您的应用中,添加以下方法(记得更改 String url
值):
public static void sendMeScreenshot() {
Form form = Display.getInstance().getCurrent();
if (form != null) {
try {
Image screenshot = Image.createImage(form.getWidth(), form.getHeight());
form.paintComponent(screenshot.getGraphics(), true);
String file = FileSystemStorage.getInstance().getAppHomePath() + "/screenshot_" + System.currentTimeMillis() + ".png";
OutputStream output = FileSystemStorage.getInstance().openOutputStream(file);
ImageIO.getImageIO().save(screenshot, output, ImageIO.FORMAT_PNG, 1.0f);
String url = "https://www.example.com/mydir/upload.php";
MultipartRequest request = new MultipartRequest();
request.setUrl(url);
request.addData("screenshot", file, "multipart/form-data");
NetworkManager.getInstance().addToQueue(request);
} catch (IOException ex) {
Log.e(ex);
}
}
}
最后,在需要的时间后,使用 UITimer.timer(5000, false, hi, () -> sendMeScreenshot());
之类的代码获取您感兴趣的表单的屏幕截图。
在模拟器中测试,应该可以。添加一些日志记录并在网络监视器中检查返回的 JSON。如果一切正常,请使用 Browser Stack App Live 打开您的应用,选择所需的设备(在本例中为 iPhone 11)。您将在 VPS 的选择 upload
目录中找到屏幕截图(或多个屏幕截图)。您可以使用 scp
下载它们或直接在浏览器中打开它们。
如果您没有所需的设备,此解决方案很有用,但请记住不要让您的 upload.php
保持在线状态,以免出现安全问题。
AppStore 现在需要 IPhone 11(或高 IPhone X)皮肤用于其 6.5 英寸元数据图像。请有人指出我的方向,以便在我的 Codenameone 模拟器中使用。
我正在安装最新版本 (CN1 v6),我的 .codenameone 文件夹中最多有 IPhoneX.skin,但我希望尽可能多地证明未来,所以选择 11。谢谢
我们还没有 iPhone 11 的皮肤,尽管您可以就那个 here 提交 RFE。但这对大多数人来说并不重要。
大多数人使用诸如此类的工具以可移植的方式生成屏幕截图:
我遇到了同样的问题。我使用不同的方法来获取一个或多个屏幕截图 根据商店的要求。简而言之,我在“Browser Stack App Live”(有多个真实设备,如所需的 iPhone 11) 上执行应用程序,使用以编程方式发送给我的代码使用 REST 请求的应用程序的一张或多张屏幕截图。
请注意,在 Browser Stack App Live 上无法发送电子邮件,因此我创建了自己的 REST API 用于屏幕截图上传。
很简单,我在分享之前测试了以下解决方案。在安装了 Apache + PHP 的临时 VPS 上,或者如果您有 public IP,则在本地计算机上创建以下内容 upload.php
,记得更新 $server_url
与你实际的 url:
<?php
header('Content-Type: application/json; charset=utf-8');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
$response = array();
$upload_dir = 'uploads/';
$server_url = 'https://www.example.com/mydir/';
if($_FILES['screenshot'])
{
$screenshot_name = $_FILES["screenshot"]["name"];
$screenshot_tmp_name = $_FILES["screenshot"]["tmp_name"];
$error = $_FILES["screenshot"]["error"];
if($error > 0){
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}else
{
$random_name = rand(1000,1000000)."-".$screenshot_name;
$upload_name = $upload_dir.strtolower($random_name);
$upload_name = preg_replace('/\s+/', '-', $upload_name);
if(move_uploaded_file($screenshot_tmp_name , $upload_name)) {
$response = array(
"status" => "success",
"error" => false,
"message" => "File uploaded successfully",
"url" => $server_url."/".$upload_name
);
}else
{
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}
}
}else{
$response = array(
"status" => "error",
"error" => true,
"message" => "No file was sent!"
);
}
echo json_encode($response);
?>
之后,mkdir uploads
和 chown
相应地 php 文件和上传目录的权限。
服务器已准备就绪。
在您的应用中,添加以下方法(记得更改 String url
值):
public static void sendMeScreenshot() {
Form form = Display.getInstance().getCurrent();
if (form != null) {
try {
Image screenshot = Image.createImage(form.getWidth(), form.getHeight());
form.paintComponent(screenshot.getGraphics(), true);
String file = FileSystemStorage.getInstance().getAppHomePath() + "/screenshot_" + System.currentTimeMillis() + ".png";
OutputStream output = FileSystemStorage.getInstance().openOutputStream(file);
ImageIO.getImageIO().save(screenshot, output, ImageIO.FORMAT_PNG, 1.0f);
String url = "https://www.example.com/mydir/upload.php";
MultipartRequest request = new MultipartRequest();
request.setUrl(url);
request.addData("screenshot", file, "multipart/form-data");
NetworkManager.getInstance().addToQueue(request);
} catch (IOException ex) {
Log.e(ex);
}
}
}
最后,在需要的时间后,使用 UITimer.timer(5000, false, hi, () -> sendMeScreenshot());
之类的代码获取您感兴趣的表单的屏幕截图。
在模拟器中测试,应该可以。添加一些日志记录并在网络监视器中检查返回的 JSON。如果一切正常,请使用 Browser Stack App Live 打开您的应用,选择所需的设备(在本例中为 iPhone 11)。您将在 VPS 的选择 upload
目录中找到屏幕截图(或多个屏幕截图)。您可以使用 scp
下载它们或直接在浏览器中打开它们。
如果您没有所需的设备,此解决方案很有用,但请记住不要让您的 upload.php
保持在线状态,以免出现安全问题。