Xamarin: HTTP GETリクエスト

概要 XamarinでSystem.Net.Http.HttpClientを使用してHTTPのGETリクエストを行う。 docs.microsoft.com サンプルコード static readonly HttpClient client = new HttpClient(); // A) async void OnButtonClicked(System.Object sender, System.EventArgs e…

Xamarin: ファイル読み書き

概要 ファイルの読み書きを行う。 サンプルコード System.IO.Fileクラスを使用する。 public MainPage() { InitializeComponent(); // サンプルファイルパスの取得 String documentDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);…

How to deal with out of memory problem while create thumbnail by PDFKit

iOS

Summary PDFKit has a method thumbnailOfSize: for create thumbnail but when you create thumbnail of all page by this method, memory consumption is increasing and it's cause of app crash. Solution You have to release PDFDocument instance tha…

Add any files in your iOS application bundle and use it in the app.

iOS

Outline You can add any files in your iOS application at build phase and use it in the app. Add files Add any files to your Xcode project. The following example add text file sample.txt. When you add files to the Xcode project, Xcode add t…

iOS版PDFKitでメモリ消費を押さえながらサムネイルを生成する

iOS

概要 iOS版PDFKitではPDFPageクラスにサムネイル生成用のメソッドthumbnailOfSize:が用意されている。このメソッドを使用して全ページのサムネイル画像を生成していくと、PDFによってはメモリ消費量がどんどん増加していき、アプリがクラッシュする。 解決策…

iOSアプリ内に埋め込んだファイルをプログラムから利用する

iOS

概要 アプリ内に任意のファイルを埋め込んでおき、プログラムからそのファイルにアクセスして利用する。 ファイルの追加 Xcodeプロジェクト内にファイルを追加する。以下ではテキストファイルsample.txtを追加している。 ファイルを追加すると、自動的にプロ…

Xamarin: 無料のAppleアカウントで実機iOSデバイスにアプリをインストールする

概要 Apple Developer Program(年間11,800円)に登録せずに無料のAppleアカウントで実機のiOSデバイスにアプリをインストールする。 手順 Xamarinプロジェクトを作成する。 通常通り、Xamarinプロジェクトを作成します。以下ではアプリケーションIDがcom.comp…