Tag: xamarin.ios

OxyPlot:如何使用轴标签格式化器并显示Y标签?

我正在使用Oxyplot为我的Xamarin.iOS项目绘制条形图.. 这是我的图表目前看起来喜欢的 这里是x轴值而不是数字,我想显示太阳,mon true,wed ….. 我可以看到CategoryAxis有一个名为LabelFormatter的方法,它返回Func ,但我该如何使用它? 还有为什么Y轴标签没有显示??? public class MyClass { /// /// Gets or sets the plot model that is shown in the demo apps. /// /// My model. public PlotModel MyModel { get; set; } /// /// Initializes a new instance of the class. /// public MyClass() { var model = new […]

无法将Xamarin.Android和Xamarin.iOS添加到PCL

我正在尝试使用MvvmCross来训练一个示例项目 ,但我坚持在VS2012中添加框架的第一步。 当我尝试在PCL项目中添加Xamarin.Android和Xamarin.iOS框架时,它显示错误 在您选择的框架之间没有可移植的可用function 我尝试按照这个答案中的步骤,但它没有奏效。 有人能否解释这个问题。 谢谢。

C#WebClient下载字符串https

在webbrowser中,我通常可以加载以下URL: https://security.ultimatxxxx.com:443/Serverstatus.ashx ://security.ultimatxxxx.com:443 / https://security.ultimatxxxx.com:443/Serverstatus.ashx 当我这样做时: Webclient.DownloadStringAsync(“https://security.ultimatxxxx.com:443/Serverstatus.ashx”); 出于测试目的,您可以调用: ultimate-eur而不是ultimatxxxx 。 它不起作用,但是当我加载没有https的普通URL时我没有问题。 我必须添加哪个参数,以便Webclient也可以下载字符串? 我想在Monotouch中使用该function,但语言是C#。

MonoTouch:uncaughtExceptionHandler?

在MonoTouch中,如何注册未捕获的exception处理程序(或类似函数) 在Obj-C中: void uncaughtExceptionHandler(NSException *exception) { [FlurryAnalytics logError:@”Uncaught” message:@”Crash!” exception:exception]; } – (void)applicationDidFinishLaunching:(UIApplication *)application { NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); [FlurryAnalytics startSession:@” “]; …. }

Xamarin.iOS ARKit演示项目出错:“当部署目标为11或更高版本时,不支持32位体系结构”

从https://developer.xamarin.com/samples/monotouch/ios11/ARKitSample/部署ARKit示例项目时,我得到构建错误Invalid architecture: ARMv7. 32-bit architectures are not supported when deployment target is 11 or later Invalid architecture: ARMv7. 32-bit architectures are not supported when deployment target is 11 or later 。 使用部署设备和我的开发机器的所有内容都会检查: 我在部署设备上运行iOS 11(iPhone 6S Plus – ARKit将无法在模拟器中运行),并安装了Xcode 9(并在启动Visual Studio for Mac之前启动了一次)。 Visual Studio for Mac也已更新到最新的Stable版本(此时Alpha版和Beta版本尚未提供ARKit)。 我正在发布下面这个问题的修复程序,希望能帮助其他人在iOS 11上使用ARKit进行开发。

如何在Xamarin中找到当前的UIViewController

我正在使用Facebook Auth SDK ,以及Xamarin Forms C# 示例 。 但是,Facebook SDK已经对该方法进行了折旧,并将其替换为将一个fromViewController变量添加到构造函数中的方法。 我对Xamarin中的ViewControllers概念并不是特别熟悉,或者确实使用这个代码,因为它来自一个示例,所以有没有办法测量当前的ViewController? 我见过几个.net示例,例如NSArray *viewContrlls=[[self navigationController] viewControllers];[viewContrlls lastObject]; 但是,这种方法似乎不适用于Xamarin,因为self不包含navigationControllers的定义。 或者,有没有什么方法可以使用示例代码轻松计算出当前ViewController的哪个变量?

使用Httpclient信任自签名证书

我正在尝试通过自签名证书发出失败的Web请求: Client = new HttpClient(); HttpResponseMessage Response = await Client.GetAsync(Uri)//defined elsewhere 这会引发信任失败exception。 我按照这里建议使用httpclienthandler再次尝试使用HttpClient允许不受信任的SSL证书 : var handler = new HttpClientHandler(); handler.ServerCertificateCustomValidationCallback = ( HttpRequestMessage message, X509Certificate2 cert, X509Chain chain, SslPolicyErrors errors ) =>{return true; };//remove if this makes it to production Client = new HttpClient(handler); 抛出一个未实现exception的系统。 有没有其他方法可以信任自签名证书? 我甚至在提出请求的机器上安装了证书,但没有运气。

可以在monotouch中动态执行代码吗?

在C#.net中,我们可以使用System.Codedom.Provider动态运行代码。 同样有可能在Monotouch(iPhone / iPad)中动态执行代码。 提前致谢,

在MVVMCross中将对象传递给“导航到”viewmodel的最佳方法是什么?

我有一个ViewModel,它包含一个Team,它有一个Players属性,它是一个Player对象列表。 在TeamView中,Team是深度加载的,因此播放器数据已经在内存中。 将给定的选定Player类实例传递给PlayerView的最佳方法是什么? 问题是MVVMCross ViewModel构造函数只能包含当前版本的字符串属性。 我有以下想法: 传递所选Player的Id并将Team.Players属性作为ViewModel分配给PlayerView。 如果所选择的玩家只是PlayerView中的焦点玩家并且PlayerView实际上是“玩家”视图,那么这可以是合理的解决方案,其中用户也可以在其他团队玩家之间滑动。 有一个像ViewBag一样的ASP.Net MVC服务,它只能在导航动作之间传递数据,在类似存储的字典中,传递给PlayerView的参数是一个“viewbag:PlayerId123”,它是一个指向类实例的特殊键。 将所选对象序列化为字符串,并将其作为序列化对象传递给构造函数。 这是有可能的,但我不喜欢这个解决方案。

Newtonsoft.Json反序列化Xamarin iOS项目中的对象

我在Xamarin.Forms项目中遇到了一些非常奇怪的行为。 我正在从REST API中检索一些序列化数据。 然后我尝试使用Json.NET将其反序列化为一个对象。 这在Android上完全正常,如果我将代码复制到.NET控制台应用程序,它也可以工作。 但是在我的iOS项目中,对.DeserializeObject()的调用只返回null。 它不会以任何方式抛出错误或抱怨。 我确实找到了这个讨论: https : //forums.xamarin.com/discussion/15152/deserialization-not-working-with-json-net-on-ios-device-ios-simulator-works ,但我没有链接首先是所有程序集并尝试设置TJPurtell.1752建议的属性也没有帮助。 谁能告诉我该怎么办? 非常感谢! 一月 编辑 这是我正在尝试反序列化的示例响应: [ { “Isbn”:{ “Isbn10″:”0099910101”, “Isbn13″:”9780099910107” }, “Title”:”A Farewell to Arms”, “Authors”:[ “Ernest Hemingway” ], “Publisher”:”Random House”, “ReleaseDate”:”1994″, “PageCount”:293, “Description”:”In 1918 Ernest Hemingway went to war, to the ‘war to end all wars’. He volunteered for ambulance service in […]