我试图从Jtoken中检索一个字节数组:
byte[] PDF;
var results = JsonConvert.DeserializeObject<dynamic>(jsonData);
if (results != null)
{
JArray docList = (JArray)results.SelectToken("");
foreach (JToken doc in docList)
{
PDF = string.IsNullOrEmpty(doc["PDF"].ToString()) ? null : doc["PDF"];
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到这个错误:"不能隐式地将类型'newtonsoft.json.linq.Jtoken转换为byte [].存在显式转换(你是否错过了转换?)"
如何将Newton.Json.Linq.JToken转换为byte []?
谢谢.
我正在尝试使用 wget 检索资源,但是我一直收到以下错误:
Unable to establish SSL connection.
Run Code Online (Sandbox Code Playgroud)
我尝试了以下命令:
wget -d https://resourcesource.com/spring-boot-starter-parent-2.0.0.RELEASE.pom
wget --no-check-certificate -d https://resourcesource.com/spring-boot-starter-parent-2.0.0.RELEASE.pom
Run Code Online (Sandbox Code Playgroud)
两者都没有奏效。
详细日志:
Resolving resourcesource.com (resourcesource.com)... {ip address}
Caching resourcesource.com => {ip address}
Connecting to resourcesource.com
(resourcesource.com)|{ip address}:443... connected.
Created socket 3.
Releasing 0x000055c98ca7a8d0 (new refcount 1).
Initiating SSL handshake.
SSL handshake failed.
Closed fd 3
Unable to establish SSL connection.
Saving HSTS entries to /root/.wget-hsts
Run Code Online (Sandbox Code Playgroud)
我正在从 docker 容器运行它。如果我尝试通过我的机器访问资源,我就可以访问它。
非常感谢有关解决此问题的任何建议。
谢谢你。
我试图通过我的Android应用程序查看PDF,我正在使用这个库:https: //www.nuget.org/packages/Xamarin.PdfView.Android/
这是我的代码看起来像:
C#:
using Com.Joanzapata.Pdfview;
using Java.IO;
namespace Xamarin_test
{
[Activity(Label = "Xamarin", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
PDFView pdfView = FindViewById<PDFView>(Resource.Id.pdfview);
pdfView.FromAsset("test.pdf")
.DefaultPage(1)
.ShowMinimap(false)
.EnableSwipe(true)
.Load();
}
}
}
Run Code Online (Sandbox Code Playgroud)
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.joanzapata.pdfview.PDFView
android:id="@+id/pdfview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我收到此错误:
Java.Lang.RuntimeException:执行doInBackground()时发生错误
是什么造成的?
谢谢.
编辑,完整错误日志:
Java.Lang.RuntimeException: An error occured while executing doInBackground()
08-17 15:09:23.301 E/AndroidRuntime( 2153): FATAL EXCEPTION: …Run Code Online (Sandbox Code Playgroud)