When I run my app in iPhone Debug simulator modus, it works just fine. When I run my app in the IPhone Release simulator modus, it crashes.
当我在iPhone调试模拟器中运行我的应用程序时,它工作得很好。当我在IPhone发布模拟器modus上运行我的应用程序时,它会崩溃。
Does anybody know to solve this?
有人知道这个吗?
Error log:
错误日志:
Terminating runtime due to unhandled exception
Unhandled Exception:
0 IOS_UI 0x0008edfe mono_handle_exception_internal_first_pass + 2190
1 IOS_UI 0x00090842 mono_handle_exception_internal + 1602
2 IOS_UI 0x0009138f mono_handle_exception + 47
3 IOS_UI 0x000d3564 handle_signal_exception + 148
4 ??? 0x0b4b12c1 0x0 + 189469377
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x00047, 0x00071>
6 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
7 IOS_UI 0x0016c50e mono_runtime_invoke + 126
8 IOS_UI 0x0020f156 monotouch_trampoline + 3686
9 UIKit 0x02805817 -[UIViewController loadViewIfRequired] + 536
10 UIKit 0x02805882 -[UIViewController view] + 33
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr) <IL 0x0000a, 0x00030>
at MonoTouch.UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:976
at IOS_UI.SettingsScreen..ctor (IOS_UI.HomeScreen) <IL 0x00014, 0x00032>
at IOS_UI.HomeScreen.ViewDidLoad () <IL 0x00119, 0x00318>
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x00047, 0x00071>
16 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
17 IOS_UI 0x0016c50e mono_runtime_invoke + 126
18 IOS_UI 0x0020f156 monotouch_trampoline + 3686
19 UIKit 0x02805817 -[UIViewController loadViewIfRequired] + 536
20 UIKit 0x02805882 -[UIViewController view] + 33
21 UIKit 0x02805b2a -[UIViewController contentScrollView] + 36
22 UIKit 0x0281cef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
23 UIKit 0x0281cfdb -[UINavigationController _layoutViewController:] + 43
24 UIKit 0x0281d286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
25 UIKit 0x0281d381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
26 UIKit 0x0281deab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
27 UIKit 0x0281dfc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
28 UIKit 0x0281e055 -[UINavigationController __viewWillLayoutSubviews] + 33
29 UIKit 0x029233ab -[UILayoutContainerView layoutSubviews] + 233
30 UIKit 0x0277492d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
31 libobjc.A.dylib 0x040306b0 -[NSObject performSelector:withObject:] + 70
32 QuartzCore 0x04bb4fc0 -[CALayer layoutSublayers] + 240
33 QuartzCore 0x04ba933c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
34 QuartzCore 0x04bb4eaf -[CALayer layoutIfNeeded] + 166
35 UIKit 0x028138cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
36 UIKit 0x0275c1a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
37 UIKit 0x0275acbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
38 UIKit 0x0275abd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
39 UIKit 0x02759e34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
40 UIKit 0x02759c6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
41 UIKit 0x0275aa29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
42 UIKit 0x0275d922 -[UIWindow setDelegate:] + 351
43 UIKit 0x02807fec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
44 UIKit 0x02754bc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
45 UIKit 0x02754dbf -[UIWindow _setHidden:forced:] + 368
46 UIKit 0x02754f55 -[UIWindow _orderFrontWithoutMakingKey] + 49
47 UIKit 0x0275df67 -[UIWindow makeKeyAndVisible] + 65
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL 0x0000a, 0x0002c>
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126
at IOS_UI.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) <IL 0x00050, 0x00134>
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) <IL 0x00059, 0x000a7>
52 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
53 IOS_UI 0x0016c50e mono_runtime_invoke + 126
54 IOS_UI 0x0020f156 monotouch_trampoline + 3686
55 UIKit 0x027217b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
56 UIKit 0x02721da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
57 UIKit 0x02722fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
58 UIKit 0x02734315 -[UIApplication handleEvent:withNewEvent:] + 1022
59 UIKit 0x0273524b -[UIApplication sendEvent:] + 85
60 UIKit 0x02726cf8 _UIApplicationHandleEvent + 9874
61 GraphicsServices 0x04d0fdf9 _PurpleEventCallback + 339
62 GraphicsServices 0x04d0fad0 PurpleEventCallback + 46
63 CoreFoundation 0x012b6bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
64 CoreFoundation 0x012b6962 __CFRunLoopDoSource1 + 146
65 CoreFoundation 0x012e7bb6 __CFRunLoopRun + 2118
66 CoreFoundation 0x012e6f44 CFRunLoopRunSpecific + 276
67 CoreFoundation 0x012e6e1b CFRunLoopRunInMode + 123
68 UIKit 0x027227da -[UIApplication _run] + 774
69 UIKit 0x0272465c UIApplicationMain + 1211
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x00056, 0x000a4>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at IOS_UI.Application.Main (string[]) <IL 0x00007, 0x00018>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00049, 0x00077>
74 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
75 IOS_UI 0x0016c50e mono_runtime_invoke + 126
76 IOS_UI 0x00170704 mono_runtime_exec_main + 420
77 IOS_UI 0x00175af5 mono_runtime_run_main + 725
78 IOS_UI 0x00067275 mono_jit_exec + 149
79 IOS_UI 0x0020440d main + 2013
80 IOS_UI 0x00002dc5 start + 53
81 ??? 0x00000004 0x0 + 4
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at IOS_UI.SettingsScreen.ViewDidLoad () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at MonoTouch.UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:976
at IOS_UI.SettingsScreen..ctor (IOS_UI.HomeScreen lastScreen) [0x00000] in <filename unknown>:0
at IOS_UI.HomeScreen.ViewDidLoad () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126
at IOS_UI.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at IOS_UI.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0
Stacktrace:
Native stacktrace:
0 IOS_UI 0x000916bc mono_handle_native_sigsegv + 284
1 IOS_UI 0x000d778d sigabrt_signal_handler + 109
2 libsystem_c.dylib 0x9ac1c59b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libsystem_sim_c.dylib 0x041e057b abort + 140
5 IOS_UI 0x001ea4cd monoeg_g_logv + 157
6 IOS_UI 0x001ea4fb monoeg_assertion_message + 43
7 IOS_UI 0x00215ecf monotouch_unhandled_exception_handler + 159
8 IOS_UI 0x0008d24c mono_invoke_unhandled_exception_hook + 140
9 IOS_UI 0x0009123a mono_handle_exception_internal + 4154
10 IOS_UI 0x0009138f mono_handle_exception + 47
11 IOS_UI 0x000d3564 handle_signal_exception + 148
12 ??? 0x0b4b12c1 0x0 + 189469377
13 ??? 0x0b4de3c9 0x0 + 189653961
14 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
15 IOS_UI 0x0016c50e mono_runtime_invoke + 126
16 IOS_UI 0x0020f156 monotouch_trampoline + 3686
17 UIKit 0x02805817 -[UIViewController loadViewIfRequired] + 536
18 UIKit 0x02805882 -[UIViewController view] + 33
19 ??? 0x0cfc5ba0 0x0 + 217865120
20 ??? 0x170de330 0x0 + 386786096
21 ??? 0x170df712 0x0 + 386791186
22 ??? 0x170de1b0 0x0 + 386785712
23 ??? 0x0b4de3c9 0x0 + 189653961
24 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
25 IOS_UI 0x0016c50e mono_runtime_invoke + 126
26 IOS_UI 0x0020f156 monotouch_trampoline + 3686
27 UIKit 0x02805817 -[UIViewController loadViewIfRequired] + 536
28 UIKit 0x02805882 -[UIViewController view] + 33
29 UIKit 0x02805b2a -[UIViewController contentScrollView] + 36
30 UIKit 0x0281cef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
31 UIKit 0x0281cfdb -[UINavigationController _layoutViewController:] + 43
32 UIKit 0x0281d286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
33 UIKit 0x0281d381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
34 UIKit 0x0281deab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
35 UIKit 0x0281dfc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
36 UIKit 0x0281e055 -[UINavigationController __viewWillLayoutSubviews] + 33
37 UIKit 0x029233ab -[UILayoutContainerView layoutSubviews] + 233
38 UIKit 0x0277492d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
39 libobjc.A.dylib 0x040306b0 -[NSObject performSelector:withObject:] + 70
40 QuartzCore 0x04bb4fc0 -[CALayer layoutSublayers] + 240
41 QuartzCore 0x04ba933c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
42 QuartzCore 0x04bb4eaf -[CALayer layoutIfNeeded] + 166
43 UIKit 0x028138cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
44 UIKit 0x0275c1a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
45 UIKit 0x0275acbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
46 UIKit 0x0275abd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
47 UIKit 0x02759e34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
48 UIKit 0x02759c6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
49 UIKit 0x0275aa29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
50 UIKit 0x0275d922 -[UIWindow setDelegate:] + 351
51 UIKit 0x02807fec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
52 UIKit 0x02754bc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
53 UIKit 0x02754dbf -[UIWindow _setHidden:forced:] + 368
54 UIKit 0x02754f55 -[UIWindow _orderFrontWithoutMakingKey] + 49
55 UIKit 0x0275df67 -[UIWindow makeKeyAndVisible] + 65
56 ??? 0x0cfc8424 0x0 + 217875492
57 ??? 0x170dd264 0x0 + 386781796
58 ??? 0x0cfc772c 0x0 + 217872172
59 ??? 0x0cfc7827 0x0 + 217872423
60 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
61 IOS_UI 0x0016c50e mono_runtime_invoke + 126
62 IOS_UI 0x0020f156 monotouch_trampoline + 3686
63 UIKit 0x027217b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
64 UIKit 0x02721da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
65 UIKit 0x02722fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
66 UIKit 0x02734315 -[UIApplication handleEvent:withNewEvent:] + 1022
67 UIKit 0x0273524b -[UIApplication sendEvent:] + 85
68 UIKit 0x02726cf8 _UIApplicationHandleEvent + 9874
69 GraphicsServices 0x04d0fdf9 _PurpleEventCallback + 339
70 GraphicsServices 0x04d0fad0 PurpleEventCallback + 46
71 CoreFoundation 0x012b6bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
72 CoreFoundation 0x012b6962 __CFRunLoopDoSource1 + 146
73 CoreFoundation 0x012e7bb6 __CFRunLoopRun + 2118
74 CoreFoundation 0x012e6f44 CFRunLoopRunSpecific + 276
75 CoreFoundation 0x012e6e1b CFRunLoopRunInMode + 123
76 UIKit 0x027227da -[UIApplication _run] + 774
77 UIKit 0x0272465c UIApplicationMain + 1211
78 ??? 0x0cfc4bf4 0x0 + 217861108
79 ??? 0x0cfc3358 0x0 + 217854808
80 ??? 0x0cfc2b58 0x0 + 217852760
81 ??? 0x0cfc2be7 0x0 + 217852903
82 IOS_UI 0x00009d92 mono_jit_runtime_invoke + 722
83 IOS_UI 0x0016c50e mono_runtime_invoke + 126
84 IOS_UI 0x00170704 mono_runtime_exec_main + 420
85 IOS_UI 0x00175af5 mono_runtime_run_main + 725
86 IOS_UI 0x00067275 mono_jit_exec + 149
87 IOS_UI 0x0020440d main + 2013
88 IOS_UI 0x00002dc5 start + 53
89 ??? 0x00000004 0x0 + 4
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Source SettingScreen.cs
源SettingScreen.cs
public partial class SettingsScreen : UIViewController
{
private string username;
private string password;
public event EventHandler CancelEvent;
private LoginValidator loginValidator;
private static string loginStatus;
private static Boolean booleanCredentialsCheck;
private int settingAlreadyStarted;
public SettingsScreen () : base ("SettingsScreen", null)
{
try {
this.View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile ("ImageResource/Loginscreen/Background/achtergrond.png"));
settingAlreadyStarted = NSUserDefaults.StandardUserDefaults.IntForKey ("settingAlreadyStarted");
loginValidator = new LoginValidator ();
textfieldPassword.SecureTextEntry = true;
string encryptedPassword = NSUserDefaults.StandardUserDefaults.StringForKey ("settingPassword");
if (encryptedPassword != null) {
string decryptedPassword = Encrypter.Decrypt (encryptedPassword);
textfieldPassword.Text = decryptedPassword;
}
textfieldUsername.Text = NSUserDefaults.StandardUserDefaults.StringForKey ("settingUsername");
labelLoginStatus.Text = loginStatus;
} catch (Exception ex){
Console.WriteLine ("ERROR SettingsScreen");
}
}
public override void DidReceiveMemoryWarning ()
{
base.DidReceiveMemoryWarning ();
}
public override void ViewDidLoad ()
{
imageviewPopup.Image = UIImage.FromFile("ImageResource/Loginscreen/Popup/popup.png");
buttonLogin.TouchUpInside += Login;
buttonCancel.TouchUpInside += Cancel;
//Delegate voor done button van keyboard
CloseSettingsTextfieldDelegate closeSettingsTextfieldDelegate = new CloseSettingsTextfieldDelegate(this);
textfieldUsername.Delegate = closeSettingsTextfieldDelegate;
textfieldPassword.Delegate = closeSettingsTextfieldDelegate;
base.ViewDidLoad ();
}
public override void ViewDidUnload ()
{
base.ViewDidUnload ();
// Clear any references to subviews of the main view in order to
// allow the Garbage Collector to collect them sooner.
//
// e.g. myOutlet.Dispose (); myOutlet = null;
ReleaseDesignerOutlets ();
}
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
void Login (object sender, EventArgs e)
{
try {
string plainPassword = textfieldPassword.Text;
string domainAndUsername = textfieldUsername.Text;
if (domainAndUsername.Length > 4) {
string domain = domainAndUsername.Substring (0, 4);
string username = domainAndUsername.Substring (5);
if (username == null || plainPassword == null) {
loginStatus = "Niet alle velden ingevuld!";
labelLoginStatus.Text = loginStatus;
var alertLegeVelden = new UIAlertView ("Mislukt!", "Niet alle velden zijn ingevuld", null, "OK");
alertLegeVelden.Show ();
} else {
booleanCredentialsCheck = loginValidator.ValidateLogin (username, plainPassword, domain);
Console.WriteLine (booleanCredentialsCheck);
if (booleanCredentialsCheck == true) {
NSUserDefaults.StandardUserDefaults.SetString (domainAndUsername, "settingUsername");
string encryptedPassword = Encrypter.Encrypt(plainPassword);
NSUserDefaults.StandardUserDefaults.SetString (encryptedPassword, "settingPassword");
loginStatus = "Logingegevens correct";
labelLoginStatus.Text = loginStatus;
var alertSuccess = new UIAlertView ("Gelukt!", "Inloggegevens zijn correct", null, "OK");
alertSuccess.Show ();
if (settingAlreadyStarted.Equals (0)) { // Check eerste keer gestart?
NSUserDefaults.StandardUserDefaults.SetInt(1, "settingAlreadyStarted"); //Verander value van setting zodat iPhone weet dat app al eens gestart is.
}
if (CancelEvent != null) { //Sluit settings scherm
CancelEvent(this, EventArgs.Empty);
}
} else {
loginStatus = "Logingegevens foutief";
labelLoginStatus.Text = loginStatus;
var alertFail = new UIAlertView ("Mislukt!", "Inloggegevens zijn foutief", null, "OK");
alertFail.Show ();
}
}
} else {
Console.WriteLine ("Te weinig username karakters");
loginStatus = "Logingegevens foutief";
labelLoginStatus.Text = loginStatus;
var alertFailUsernameDomain = new UIAlertView ("Mislukt!", "Domein of username foutief ingevuld", null, "OK");
alertFailUsernameDomain.Show ();
}
} catch {
var alertFailUsernameDomain = new UIAlertView ("Mislukt!", "Domein of username foutief ingevuld", null, "OK");
alertFailUsernameDomain.Show ();
}
}
void Cancel (object sender, EventArgs e)
{
if (settingAlreadyStarted.Equals (0)) { // Bij eerste keer dat app wordt gestart. //Moet uiteindelijk uit setting gelezen worden.
Console.WriteLine("Annuleren niet toegestaan bij eerste keer starten app");
var alertCannotCancel = new UIAlertView ("Mislukt", "Er dient te worden ingelogd om gebruik te kunnen maken van de app", null, "OK");
alertCannotCancel.Show ();
} else {
if (CancelEvent != null) {
CancelEvent(this, EventArgs.Empty);
}
}
}
}
public class CloseSettingsTextfieldDelegate : UITextFieldDelegate{
private SettingsScreen controller;
public CloseSettingsTextfieldDelegate(SettingsScreen settingsScreen)
{
controller = settingsScreen;
}
public override bool ShouldReturn (UITextField textField)
{
textField.ResignFirstResponder();
return false;
}
}
I also noticed a strange thing when opening the settings of my app: Settings -> App:
当我打开我的app设置时,我也注意到一件奇怪的事情:设置——> app:
It shows a lot of Debug settings (100+)
它显示了许多调试设置(100+)
What could cause this?
这可能会导致什么?
3 个解决方案
#1
1
For a NullReferenceException
to occurs at this place it would means that one (or several) fields is null
. Since it does not happens on Debug you will not be able to use the debugger but you should be able to verify this by adding a few Console.WriteLine
in your application. E.g.
对于出现在此处的NullReferenceException,它将意味着一个(或多个)字段为null。由于调试上没有发生这种情况,您将无法使用调试器,但是您应该能够通过添加一些控制台来验证这一点。WriteLine在您的应用程序。如。
public override void ViewDidLoad ()
{
if (imageviewPopup == null) Console.WriteLine ("uho, no imageviewPopup");
imageviewPopup.Image = UIImage.FromFile("ImageResource/Loginscreen/Popup/popup.png");
if (buttonLogin == null) Console.WriteLine ("uho, no buttonLogin");
buttonLogin.TouchUpInside += Login;
if (buttonCancel == null) Console.WriteLine ("uho, no buttonCancel");
buttonCancel.TouchUpInside += Cancel;
...
Once that's confirmed you should have a look at your NIB file and if you have any project options that differs from Debug and Release builds.
确认之后,您应该查看您的NIB文件,如果您有与调试和发布版本不同的项目选项。
I also noticed a strange thing when opening the settings of my app: Settings -> App: It shows a lot of Debug settings (100+). What could cause this?
当我打开我的应用的设置时,我还注意到一件奇怪的事情:设置——>应用:它显示了大量的调试设置(100+)。这可能会导致什么?
This is a bug in MonoTouch that was fixed recently (the entries are duplicated at each build). That only occurs for debug builds and would not affect your application.
这是最近修复的MonoTouch中的一个bug(每个构建中的条目都是重复的)。这只发生在调试构建中,不会影响应用程序。
#2
1
Problem solved!
问题解决了!
In the project properties, I did set the compiler value for debug mode to "IOS". For release mode I forgot to set the value. Now I set this value too, it works.
在项目属性中,我确实将debug模式的编译器值设置为“IOS”。对于发布模式,我忘记设置值。现在我也设置了这个值,它是有效的。
In a class in the common project, which is used by the MonoTouch project AND Mono For Android project, I defined an if else statement for compiling. If I am right, this if else statement uses the compiler value of the project to determine what to do.
在一个公共项目的类中,这个项目被MonoTouch项目和Android项目的Mono所使用,我定义了一个if else语句来编译。如果我是对的,如果else语句使用项目的编译器值来决定要做什么。
public class Sharepoint
{
#if ANDROID
private Android_UI.Test.Database.Lists service;
#else
private Test.Database.Lists service;
#endif
private const string LISTNAME = "DatabaseFix";
private CredentialCache _credentialCache;
/// <summary>
/// Initializes a new instance of the <see cref="Test_Common.Sharepoint"/> class.
/// Requires Ordina credentials.
/// </summary>
/// <param name='username'>
/// Username.
/// </param>
/// <param name='password'>
/// Password.
/// </param>
/// <param name='domain'>
/// Domain.
/// </param>
public Sharepoint (string username, string password, string domain){
#if ANDROID
service = new Android_UI.Test.Database.Lists();
#else
service = new Test.Database.Lists();
#endif
service.Url = "https://........./_vti_bin/Lists.asmx";
_credentialCache = new CredentialCache();
_credentialCache.Add(new Uri(service.Url), "BASIC", new NetworkCredential(username, password, domain));
service.Credentials = CredentialCache.DefaultCredentials;
service.Credentials = _credentialCache;
service.Timeout = 30000; //30 seconds
}
PS. thank you all for your response
PS.谢谢大家的回复
#3
0
Just move this calls to
把这个调用移到
this.View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile ("ImageResource/Loginscreen/Background/achtergrond.png"));
settingAlreadyStarted = NSUserDefaults.StandardUserDefaults.IntForKey ("settingAlreadyStarted");
loginValidator = new LoginValidator ();
textfieldPassword.SecureTextEntry = true;
string encryptedPassword = NSUserDefaults.StandardUserDefaults.StringForKey ("settingPassword");
if (encryptedPassword != null) {
string decryptedPassword = Encrypter.Decrypt (encryptedPassword);
textfieldPassword.Text = decryptedPassword;
}
textfieldUsername.Text = NSUserDefaults.StandardUserDefaults.StringForKey ("settingUsername");
labelLoginStatus.Text = loginStatus;
to
来
public override void ViewDidLoad (){}
#1
1
For a NullReferenceException
to occurs at this place it would means that one (or several) fields is null
. Since it does not happens on Debug you will not be able to use the debugger but you should be able to verify this by adding a few Console.WriteLine
in your application. E.g.
对于出现在此处的NullReferenceException,它将意味着一个(或多个)字段为null。由于调试上没有发生这种情况,您将无法使用调试器,但是您应该能够通过添加一些控制台来验证这一点。WriteLine在您的应用程序。如。
public override void ViewDidLoad ()
{
if (imageviewPopup == null) Console.WriteLine ("uho, no imageviewPopup");
imageviewPopup.Image = UIImage.FromFile("ImageResource/Loginscreen/Popup/popup.png");
if (buttonLogin == null) Console.WriteLine ("uho, no buttonLogin");
buttonLogin.TouchUpInside += Login;
if (buttonCancel == null) Console.WriteLine ("uho, no buttonCancel");
buttonCancel.TouchUpInside += Cancel;
...
Once that's confirmed you should have a look at your NIB file and if you have any project options that differs from Debug and Release builds.
确认之后,您应该查看您的NIB文件,如果您有与调试和发布版本不同的项目选项。
I also noticed a strange thing when opening the settings of my app: Settings -> App: It shows a lot of Debug settings (100+). What could cause this?
当我打开我的应用的设置时,我还注意到一件奇怪的事情:设置——>应用:它显示了大量的调试设置(100+)。这可能会导致什么?
This is a bug in MonoTouch that was fixed recently (the entries are duplicated at each build). That only occurs for debug builds and would not affect your application.
这是最近修复的MonoTouch中的一个bug(每个构建中的条目都是重复的)。这只发生在调试构建中,不会影响应用程序。
#2
1
Problem solved!
问题解决了!
In the project properties, I did set the compiler value for debug mode to "IOS". For release mode I forgot to set the value. Now I set this value too, it works.
在项目属性中,我确实将debug模式的编译器值设置为“IOS”。对于发布模式,我忘记设置值。现在我也设置了这个值,它是有效的。
In a class in the common project, which is used by the MonoTouch project AND Mono For Android project, I defined an if else statement for compiling. If I am right, this if else statement uses the compiler value of the project to determine what to do.
在一个公共项目的类中,这个项目被MonoTouch项目和Android项目的Mono所使用,我定义了一个if else语句来编译。如果我是对的,如果else语句使用项目的编译器值来决定要做什么。
public class Sharepoint
{
#if ANDROID
private Android_UI.Test.Database.Lists service;
#else
private Test.Database.Lists service;
#endif
private const string LISTNAME = "DatabaseFix";
private CredentialCache _credentialCache;
/// <summary>
/// Initializes a new instance of the <see cref="Test_Common.Sharepoint"/> class.
/// Requires Ordina credentials.
/// </summary>
/// <param name='username'>
/// Username.
/// </param>
/// <param name='password'>
/// Password.
/// </param>
/// <param name='domain'>
/// Domain.
/// </param>
public Sharepoint (string username, string password, string domain){
#if ANDROID
service = new Android_UI.Test.Database.Lists();
#else
service = new Test.Database.Lists();
#endif
service.Url = "https://........./_vti_bin/Lists.asmx";
_credentialCache = new CredentialCache();
_credentialCache.Add(new Uri(service.Url), "BASIC", new NetworkCredential(username, password, domain));
service.Credentials = CredentialCache.DefaultCredentials;
service.Credentials = _credentialCache;
service.Timeout = 30000; //30 seconds
}
PS. thank you all for your response
PS.谢谢大家的回复
#3
0
Just move this calls to
把这个调用移到
this.View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile ("ImageResource/Loginscreen/Background/achtergrond.png"));
settingAlreadyStarted = NSUserDefaults.StandardUserDefaults.IntForKey ("settingAlreadyStarted");
loginValidator = new LoginValidator ();
textfieldPassword.SecureTextEntry = true;
string encryptedPassword = NSUserDefaults.StandardUserDefaults.StringForKey ("settingPassword");
if (encryptedPassword != null) {
string decryptedPassword = Encrypter.Decrypt (encryptedPassword);
textfieldPassword.Text = decryptedPassword;
}
textfieldUsername.Text = NSUserDefaults.StandardUserDefaults.StringForKey ("settingUsername");
labelLoginStatus.Text = loginStatus;
to
来
public override void ViewDidLoad (){}