- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
当我在 Monotouch iOS 6 中使用 MFMailComposeViewController 时出现一个奇怪的错误,但它在 iOS 5.1 中运行良好:
*** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2372/UIAppearance.m:1118
代码如下:
MFMailComposeViewController _mail;
public void SendFeedbackMail (string email_subject, string email_message_body, string[] email_recipients)
{
if (MFMailComposeViewController.CanSendMail) {
_mail = new MFMailComposeViewController ();
_mail.SetSubject (email_subject);
_mail.SetToRecipients (email_recipients);
_mail.SetMessageBody (email_message_body + "\n", false);
_mail.Finished += HandleMailFinished;
root_controller.PresentViewController(_mail, true, null);
} else {
//handle not being able to send mail
UIAlertView alert = new UIAlertView ("Mail Alert", "Error: Check your eMail configuration", null, "OK", null);
alert.Show ();
}
}
模拟器上的 native 堆栈跟踪:
Native stacktrace:
0 MyAppProject 0x0007ba5c mono_handle_native_sigsegv + 284
1 MyAppProject 0x00004a62 mono_sigsegv_signal_handler + 178
2 libsystem_c.dylib 0x93ad486b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 MyAppProject 0x0014e8be mono_runtime_invoke + 126
5 MyAppProject 0x001ec80f monotouch_exception_handler + 63
6 CoreFoundation 0x020e0318 __handleUncaughtException + 728
7 libobjc.A.dylib 0x0228d0b9 _ZL15_objc_terminatev + 86
8 libstdc++.6.dylib 0x0289e652 _ZSt9terminatev + 21
9 libobjc.A.dylib 0x0228d039 _destroyAltHandlerList + 0
10 libdispatch.dylib 0x0299d027 _dispatch_client_callout + 33
11 libdispatch.dylib 0x0298cd5f _dispatch_barrier_sync_f_invoke + 58
12 libdispatch.dylib 0x0298caa3 dispatch_barrier_sync_f + 108
13 libdispatch.dylib 0x0298ce5e dispatch_sync + 45
14 UIKit 0x00f7ffad __76-[_UIRemoteViewControllerConnectionRequest _connectToViewControllerOperator]_block_invoke_0 + 105
15 UIKit 0x00f8be46 __block_global_0 + 54
16 libdispatch.dylib 0x0299d014 _dispatch_client_callout + 14
17 libdispatch.dylib 0x0298f09f dispatch_once_f + 57
18 libdispatch.dylib 0x0298f061 dispatch_once + 31
19 UIKit 0x00f8be0a __73-[_UIViewServiceSessionEndpoint connectToDeputyOfType:connectionHandler:]_block_invoke_0 + 105
20 UIKit 0x00f8c002 __73-[_UIViewServiceSessionEndpoint connectToDeputyOfType:connectionHandler:]_block_invoke_040 + 25
21 UIKit 0x00fe94e9 __block_global_0 + 32
22 libdispatch.dylib 0x0298b53f _dispatch_call_block_and_release + 15
23 libdispatch.dylib 0x0299d014 _dispatch_client_callout + 14
24 libdispatch.dylib 0x0298d418 _dispatch_queue_drain + 239
25 libdispatch.dylib 0x0298d2a6 _dispatch_queue_invoke + 59
26 libdispatch.dylib 0x0298e280 _dispatch_root_queue_drain + 231
27 libdispatch.dylib 0x0298e450 _dispatch_worker_thread2 + 39
28 libsystem_c.dylib 0x93aeae12 _pthread_wqthread + 441
29 libsystem_c.dylib 0x93ad2cca start_wqthread + 30
同样在模拟器上,应用程序在调试器上抛出异常并崩溃之前会挂起一段时间:
Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown. at Mono.Debugger.Soft.Connection.SendReceive (CommandSet command_set, Int32 command, Mono.Debugger.Soft.PacketWriter packet) [0x00117] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs:1420
at Mono.Debugger.Soft.Connection.Type_GetCustomAttributes (Int64 id, Int64 attr_type_id, Boolean inherit) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs:1986
at Mono.Debugger.Soft.TypeMirror.GetCAttrs (Mono.Debugger.Soft.TypeMirror type, Boolean inherit) [0x0003d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs:679
at Mono.Debugger.Soft.TypeMirror.GetCustomAttributes (Boolean inherit) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs:664
at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetTypeDisplayData (Mono.Debugging.Evaluation.EvaluationContext gctx, System.Object type) [0x0001e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs:1066
Application Terminated
Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.
at Mono.Debugger.Soft.Connection.SendReceive (CommandSet command_set, Int32 command, Mono.Debugger.Soft.PacketWriter packet) [0x0013f] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs:1425
at Mono.Debugger.Soft.Connection.Type_GetMethodsByNameFlags (Int64 id, System.String name, Int32 flags, Boolean ignoreCase) [0x00016] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs:2002
at Mono.Debugger.Soft.TypeMirror.GetMethodsByNameFlags (System.String name, BindingFlags flags, Boolean ignoreCase) [0x0001c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs:691
at Mono.Debugging.Soft.SoftDebuggerAdaptor.OverloadResolve (Mono.Debugging.Soft.SoftEvaluationContext ctx, System.String methodName, Mono.Debugger.Soft.TypeMirror type, Mono.Debugger.Soft.TypeMirror[] argtypes, Boolean allowInstance, Boolean allowStatic, Boolean throwIfNotFound) [0x00073] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs:1231
at Mono.Debugging.Soft.SoftDebuggerAdaptor.CallToString (Mono.Debugging.Evaluation.EvaluationContext ctx, System.Object obj) [0x00107] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs:91
at Mono.Debugging.Evaluation.ObjectValueAdaptor.TargetObjectToObject (Mono.Debugging.Evaluation.EvaluationContext ctx, System.Object obj) [0x00349] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ObjectValueAdaptor.cs:980
at Mono.Debugging.Soft.SoftDebuggerAdaptor.TargetObjectToObject (Mono.Debugging.Evaluation.EvaluationContext gctx, System.Object obj) [0x001a5] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs:1400
at Mono.Debugging.Evaluation.ExpressionEvaluator.TargetObjectToExpression (Mono.Debugging.Evaluation.EvaluationContext ctx, System.Object obj) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ExpressionEvaluator.cs:83
at Mono.Debugging.Evaluation.ObjectValueAdaptor.CreateObjectValueImpl (Mono.Debugging.Evaluation.EvaluationContext ctx, IObjectValueSource source, ObjectPath path, System.Object obj, ObjectValueFlags flags) [0x000f5] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ObjectValueAdaptor.cs:385
at Mono.Debugging.Evaluation.ObjectValueAdaptor.CreateObjectValue (Mono.Debugging.Evaluation.EvaluationContext ctx, IObjectValueSource source, ObjectPath path, System.Object obj, ObjectValueFlags flags) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ObjectValueAdaptor.cs:93
设备上的 native 堆栈跟踪:
0 MyAppProject 0x01b39e85 mono_handle_native_sigsegv + 244
1 MyAppProject 0x01afe3cf mono_sigsegv_signal_handler + 130
2 libsystem_c.dylib 0x3aaa8e93 _sigtramp + 42
3 MyAppProject 0x01b92a9d mono_domain_get + 20
4 MyAppProject 0x01b5d53b mono_runtime_invoke + 90
5 MyAppProject 0x01bbd8c0 monotouch_exception_handler + 72
6 CoreFoundation 0x36cee57f <redacted> + 614
7 libobjc.A.dylib 0x34ffea65 <redacted> + 128
8 libc++abi.dylib 0x33e4807b <redacted> + 78
9 libc++abi.dylib 0x33e48114 <redacted> + 19
10 libc++abi.dylib 0x33e49513 __cxa_throw + 122
11 libobjc.A.dylib 0x34ffe9bf objc_exception_throw + 94
12 CoreFoundation 0x36cee15d <redacted> + 0
13 Foundation 0x3477030b <redacted> + 86
14 UIKit 0x3834a925 <redacted> + 1844
15 UIKit 0x38349a7b <redacted> + 634
16 CoreFoundation 0x36ceb62f <redacted> + 714
17 UIKit 0x383497f5 <redacted> + 136
18 UIKit 0x384275e5 <redacted> + 60
19 UIKit 0x383b5cd7 <redacted> + 206
20 UIKit 0x383b5b6d <redacted> + 264
21 libdispatch.dylib 0x359e29f7 <redacted> + 30
22 UIKit 0x383b5a61 <redacted> + 92
23 UIKit 0x383bf0d5 <redacted> + 32
24 libdispatch.dylib 0x359e43f7 <redacted> + 42
25 UIKit 0x383bf0b1 <redacted> + 88
26 libdispatch.dylib 0x359df11f <redacted> + 10
27 libdispatch.dylib 0x359e2ecf <redacted> + 142
28 libdispatch.dylib 0x359e2dc1 <redacted> + 40
29 libdispatch.dylib 0x359e391d <redacted> + 184
30 libdispatch.dylib 0x359e3ac1 <redacted> + 84
31 libsystem_c.dylib 0x3aa76a11 <redacted> + 360
32 libsystem_c.dylib 0x3aa768a4 start_wqthread + 8
感谢任何帮助。谢谢。
更新:
不幸的是,这里的错误似乎不止一个。
在我的案例中,邮件编辑器的崩溃不是由外观或属性字符串。我测试了所有可能的连接,但我的代码崩溃了。
所以我开始逐行注释我的所有代码,并确定了它:
这是应用内购买代码。
我使用的是来自 xamarin 网站上的应用内购买示例的代码。
如果我使用 SKProductRequest 类只注释这一行:
productsRequest.Start();
MFMailComposer 打开并运行良好!
所以我在原始 Xamarin 示例项目上测试了 MFMailComposer:
http://docs.xamarin.com/ios/tutorials/In-App_Purchasinghttp://docs.xamarin.com/@api/deki/files/3300/=InAppPurchaseSample.zip
我刚刚将这段代码添加到 NonConsumableViewController 类中:
/// <summary>
/// TEST MAIL COMPOSER BUG - START
/// </summary>
MFMailComposeViewController _mail;
void HandleFinished (object sender, MFComposeResultEventArgs e)
{
}
public void TestMailComposer ()
{
var button = UIButton.FromType(UIButtonType.RoundedRect);
button.Frame = new RectangleF(20f, 0f, 280f, 40f);
button.TouchUpInside += (object sender, EventArgs e) => {
if (MFMailComposeViewController.CanSendMail) {
_mail = new MFMailComposeViewController ();
_mail.SetSubject ("The Subject");
_mail.SetToRecipients (new [] {"the@recipient.com"});
_mail.SetMessageBody ("Some text to e-mail stuff too" +
"\n", false);
_mail.Finished += HandleFinished;
this.PresentViewController(_mail, true, null);
} else {
//handle not being able to send mail
UIAlertView alert = new UIAlertView ("Mail Alert", "Error:
Check your eMail configuration", null, "OK", null);
alert.Show ();
}
};
button.SetTitle("Button", UIControlState.Normal);
View.AddSubview(button);
}
///
/// TEST MAIL COMPOSER BUG - END
///
当我按下按钮时它挂起。
更新:
我尝试了 6.0.2 修补程序(抱歉让您久等了,但我不得不将我的代码恢复到原始状态)。外观错误现在消失了。
SKProductRequest 类的问题似乎是一个不同的问题并且不那么紧迫。它没有挂起,只是延迟了 MF 邮件编辑器的打开一段时间。但这似乎是一个不相关的错误。
最佳答案
这可能有帮助(来自 Xamarin 错误)
cancelAttributes = new UITextAttributes();
//cancelAttributes.TextShadowOffset = new UIOffset(0, -1);
cancelAttributes.TextShadowColor = UIColor.White.ColorWithAlpha(0.5f);
cancelAttributes.TextColor = Resources.CancelButtonDisabled;
UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(cancelAttributes, UIControlState.Disabled);
如果我的代码中有注释位,我就会遇到问题,但如果它被注释掉,我就会遇到问题。你在使用 UIAppearance 的东西吗?
关于objective-c - 使用 MFMailComposeViewController 时 Monotouch iOS 6 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12567708/
IO 设备如何知道属于它的内存中的值在memory mapped IO 中发生了变化? ? 例如,假设内存地址 0 专用于保存 VGA 设备的背景颜色。当我们更改 memory[0] 中的值时,VGA
我目前正在开发一个使用Facebook sdk登录(通过FBLoginView)的iOS应用。 一切正常,除了那些拥有较旧版本的facebook的人。 当他们按下“使用Facebook登录”按钮时,他
假设我有: this - is an - example - with some - dashesNSRange将使用`rangeOfString:@“-”拾取“-”的第一个实例,但是如果我只想要最后
Card.io SDK提供以下详细信息: 卡号,有效期,月份,年份,CVV和邮政编码。 如何从此SDK获取国家名称。 - (void)userDidProvideCreditCardInfo:(Car
iOS 应用程序如何从网络服务下载图片并在安装过程中将它们安装到用户的 iOS 设备上?可能吗? 最佳答案 您无法控制应用在用户设备上的安装,因此无法在安装过程中下载其他数据。 只需在安装后首次启动应
我曾经开发过一款企业版 iOS 产品,我们公司曾将其出售给大型企业,供他们的员工使用。 该应用程序通过 AppStore 提供,企业用户获得了公司特定的配置文件(包含应用程序配置文件)以启用他们有权使
我正在尝试将 Card.io SDK 集成到我的 iOS 应用程序中。我想为 CardIO ui 做一个简单的本地化,如更改取消按钮标题或“在此保留信用卡”提示文本。 我在 github 上找到了这个
我正在使用 CardIOView 和 CardIOViewDelegate 类,没有可以设置为 YES 的 BOOL 来扫描 collectCardholderName。我可以看到它在 CardIOP
我有一个集成了通话工具包的 voip 应用程序。每次我从我的 voip 应用程序调用时,都会在 native 电话应用程序中创建一个新的最近通话记录。我在 voip 应用程序中也有自定义联系人(电话应
iOS 应用程序如何知道应用程序打开时屏幕上是否已经有键盘?应用程序运行后,它可以接收键盘显示/隐藏通知。但是,如果应用程序在分屏模式下作为辅助应用程序打开,而主应用程序已经显示键盘,则辅助应用程序不
我在模拟器中收到以下错误: ImageIO: CGImageReadSessionGetCachedImageBlockData *** CGImageReadSessionGetCachedIm
如 Apple 文档所示,可以通过 EAAccessory Framework 与经过认证的配件(由 Apple 认证)进行通信。但是我有点困惑,因为一些帖子告诉我它也可以通过 CoreBluetoo
尽管现在的调试器已经很不错了,但有时找出应用程序中正在发生的事情的最好方法仍然是古老的 NSLog。当您连接到计算机时,这样做很容易; Xcode 会帮助弹出日志查看器面板,然后就可以了。当您不在办公
在我的 iOS 应用程序中,我定义了一些兴趣点。其中一些有一个 Kontakt.io 信标的名称,它绑定(bind)到一个特定的 PoI(我的意思是通常贴在信标标签上的名称)。现在我想在附近发现信标,
我正在为警报提示创建一个 trigger.io 插件。尝试从警报提示返回数据。这是我的代码: // Prompt + (void)show_prompt:(ForgeTask*)task{
您好,我是 Apple iOS 的新手。我阅读并搜索了很多关于推送通知的文章,但我没有发现任何关于 APNS 从 io4 到 ios 6 的新更新的信息。任何人都可以向我提供 APNS 如何在 ios
UITabBar 的高度似乎在 iOS 7 和 8/9/10/11 之间发生了变化。我发布这个问题是为了让其他人轻松找到答案。 那么:在 iPhone 和 iPad 上的 iOS 8/9/10/11
我想我可以针对不同的 iOS 版本使用不同的 Storyboard。 由于 UI 的差异,我将创建下一个 Storyboard: Main_iPhone.storyboard Main_iPad.st
我正在写一些东西,我将使用设备的 iTunes 库中的一部分音轨来覆盖 2 个视频的组合,例如: AVMutableComposition* mixComposition = [[AVMutableC
我创建了一个简单的 iOS 程序,可以顺利编译并在 iPad 模拟器上运行良好。当我告诉 XCode 4 使用我连接的 iPad 设备时,无法编译相同的程序。问题似乎是当我尝试使用附加的 iPad 时
我是一名优秀的程序员,十分优秀!