質問編集履歴
3
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
```
|
94
94
|
|
95
|
-
IPlatformInfo info = DependencyService.G
|
95
|
+
IPlatformInfo info = DependencyService.Get<IPlatformInfo>();
|
96
96
|
|
97
97
|
```
|
98
98
|
|
2
補足説明追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,3 +33,75 @@
|
|
33
33
|
|
34
34
|
|
35
35
|
using でXamarin.iOSも読み込むこともできませんMobileTrader.iOSも読み込むことができませんでした。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
### DependencyService 検証コード
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
**MobileTrader / IPlatformInfo.cs**
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
namespace MobileTrader
|
48
|
+
|
49
|
+
{
|
50
|
+
|
51
|
+
public interface IPlatformInfo
|
52
|
+
|
53
|
+
{
|
54
|
+
|
55
|
+
string GetDeviceModel();
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
**MobileTrader.iOS / PlatformInfo.cs**
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
[assembly: Xamarin.Forms.Dependency(typeof(MobileTrader.iOS.PlatformInfo))]
|
68
|
+
|
69
|
+
namespace MobileTrader.iOS
|
70
|
+
|
71
|
+
{
|
72
|
+
|
73
|
+
public class PlatformInfo : IPlatformInfo
|
74
|
+
|
75
|
+
{
|
76
|
+
|
77
|
+
public string GetDeviceModel()
|
78
|
+
|
79
|
+
{
|
80
|
+
|
81
|
+
return Xamarin.iOS.DeviceHardware.Model;
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
```
|
90
|
+
|
91
|
+
**呼び出し側 : MobileTrader **
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
IPlatformInfo info = DependencyService.GET<IPlatformInfo>();
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
**実行時エラー : 呼び出し側のコードで発生**
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
System.MissingException : <Timeout exceeded setting exception details>
|
106
|
+
|
107
|
+
```
|
1
詳細追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,3 +25,11 @@
|
|
25
25
|
DeviceData = Xamarin.iOS.DeviceHardware.Model
|
26
26
|
|
27
27
|
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
### 試したこと
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
using でXamarin.iOSも読み込むこともできませんMobileTrader.iOSも読み込むことができませんでした。
|