HTMLでXMLHttpRequestを利用したHTTP通信のクロスドメイン制約の概要についてのまとめです。
Emscripten, Unity(WebGL,WebPlayer),Flashなどで問題の発生が予測されます。
XMLHttpRequest(以下XHR)はブラウザで既に読み込み済みのページからさらにHTTP通信を行うAPIです。
しかしXHRはセキュリティ上の理由でリクエスト先がHTMLファイルと同じドメインでなければいけないという制約があります。
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.os.Build; | |
import android.telephony.PhoneStateListener; | |
import android.telephony.TelephonyManager; | |
import permissions.dispatcher.PermissionUtils; | |
/* |
// AndroidManifest.xml に <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> の設定が必要 | |
string GetSSID() | |
{ | |
string ssid = "N/A"; | |
using (var activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity")) { | |
var wifiManager = activity.Call<AndroidJavaObject>("getSystemService", "wifi"); | |
ssid = wifiManager.Call<AndroidJavaObject>("getConnectionInfo").Call<string>("getSSID"); | |
} |
Another problem I faced with while development of Unity plugin is Exception while HTTP request from the iOS platform. It produces such stacktrace:
ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<Mono.Security.Protocol.Tls.HttpsClientStream, bool> (System.Reflection.MonoProperty/Getter`2<Mono.Security.Protocol.Tls.HttpsClientStream, bool>,object)' while running with --aot-only.
at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0
at System.Net.WebConnection.Write (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.String& err_msg) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.WriteHeaders () [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error) [0x000
Unite | |
---------------------------------------------------------------------- | |
1:開場 | |
・ かなりの待機列 | |
・ ノベリティと名札を受け取って入場 | |
・ 開場は3つの開場を繋げた形で椅子や様子はデブサミに近い。 | |
・ Unity関連のゲームやツールの動画が続々と流されている。音響もよい。 | |
・ アナウンスがアニメ声 | |
・ 同時通訳機と水が椅子に用意されていた。 |
- (void)repaint | |
{ | |
EAGLContextSetCurrentAutoRestore autorestore(_mainDisplay->surface.context); | |
SetupUnityDefaultFBO(&_mainDisplay->surface); | |
// ... | |
} |
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class CreateMesh { | |
//16250枚Quadが入ったMeshを作る。 | |
[MenuItem("Custom/Create/16250meshes")] | |
public static void CreateParticleMesh(){ | |
Mesh mesh = new Mesh(); | |
int vertexCount = 65000; |
using System.Collections; | |
using UnityEditor; | |
[InitializeOnLoad] | |
public class SceneSave | |
{ | |
static SceneSave () | |
{ | |
EditorApplication.playmodeStateChanged = () => | |
{ |