UIAlertController crashes when running under XCode 6.1 debugger - xcode6.1

My iPad app (XCode 6.1.1, iOS 8.1.1, ARC, Storyboards) issues this code when verifying the user wants to delete a record:
// create an action sheet
UIAlertController *view= [UIAlertController
alertControllerWithTitle:#"Warning!"
message:NSLocalizedString(#"Are you sure you want to delete this appointment?",nil)
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* yes = [UIAlertAction
actionWithTitle:#"Yes"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[self deleteSingleAppointment];
[view dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction* no = [UIAlertAction
actionWithTitle:#"No"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
//Do some thing here
[view dismissViewControllerAnimated:YES completion:nil];
}];
[view addAction:yes];
[view addAction:no];
view.popoverPresentationController.sourceView = self.view;
view.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0, 1.0, 1.0);
[self presentViewController: view animated:YES completion:nil];
This code runs just fine when I run it outside the debugger on the device; this is the error shown, the stack trace follows:
UPDATED Here is the "stack trace" from 'bt':
(lldb) bt
* thread #1: tid = 0x14e4ec, 0x0000000111437dd2 CoreFoundationCFArrayGetValueAtIndex + 130, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000111437dd2 CoreFoundationCFArrayGetValueAtIndex + 130
frame #1: 0x00000001137461af CoreTextTCharStream::CopyBreakIterator(__CFString const*) + 251
frame #2: 0x0000000113745f7e CoreTextTCharStream::FindLineBreak(CFRange, bool, __CFString const*) const + 274
frame #3: 0x00000001136cde9c CoreTextTTypesetter::SuggestLineBreak(TLine const&, long, double, double) + 290
frame #4: 0x00000001136cdb52 CoreTextCTLineSuggestLineBreakWithOffset + 20
frame #5: 0x000000011a6158f3 UIFoundation__NSStringDrawingEngine + 19550
frame #6: 0x000000011a610c6f UIFoundation-[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 198
frame #7: 0x000000010faa0305 UIKit-[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 1025
frame #8: 0x000000010fa9fda0 UIKit-[UILabel textRectForBounds:limitedToNumberOfLines:] + 76
frame #9: 0x000000010faa3852 UIKit-[UILabel _intrinsicSizeWithinSize:] + 170
frame #10: 0x000000010faa3932 UIKit-[UILabel intrinsicContentSize] + 76
frame #11: 0x000000010ff59ea4 UIKit-[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 33
frame #12: 0x000000010ff59c64 UIKit-[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 422
frame #13: 0x000000010ff610d6 UIKit-[UIView(AdditionalLayoutSupport) updateConstraints] + 163
frame #14: 0x000000010faa379d UIKit-[UILabel updateConstraints] + 272
frame #15: 0x000000010ff606fa UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 248
frame #16: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #17: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #18: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #19: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #20: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #21: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #22: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #23: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #24: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #25: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #26: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #27: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #28: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #29: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #30: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #31: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #32: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #33: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #34: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #35: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #36: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #37: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #38: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #39: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #40: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #41: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #42: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #43: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #44: 0x0000000111455194 CoreFoundationCFArrayApplyFunction + 68
frame #45: 0x000000010ff6069b UIKit-[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 153
frame #46: 0x000000010ff608f2 UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 124
frame #47: 0x000000010edcbd6e Foundation-[NSISEngine withBehaviors:performModifications:] + 155
frame #48: 0x000000010ff60bd4 UIKit-[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 565
frame #49: 0x000000010ff541e0 UIKit-[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 91
frame #50: 0x000000010ff6119e UIKit-[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 159
frame #51: 0x000000010f947b2d UIKit-[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 114
frame #52: 0x000000010f953973 UIKit-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
frame #53: 0x000000010f626de8 QuartzCore-[CALayer layoutSublayers] + 150
frame #54: 0x000000010f61ba0e QuartzCoreCA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #55: 0x000000010f61b87e QuartzCoreCA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
frame #56: 0x000000010f58963e QuartzCoreCA::Context::commit_transaction(CA::Transaction*) + 242
frame #57: 0x000000010f58a74a QuartzCoreCA::Transaction::commit() + 390
frame #58: 0x000000010f58adb5 QuartzCoreCA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 89
frame #59: 0x0000000111481dc7 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #60: 0x0000000111481d20 CoreFoundation__CFRunLoopDoObservers + 368
frame #61: 0x0000000111477b53 CoreFoundation__CFRunLoopRun + 1123
frame #62: 0x0000000111477486 CoreFoundationCFRunLoopRunSpecific + 470
frame #63: 0x00000001122de9f0 GraphicsServicesGSEventRunModal + 161
frame #64: 0x000000010f8da420 UIKitUIApplicationMain + 1282
* frame #65: 0x000000010ddba9a3 SalonBookmain(argc=3, argv=0x00007fff51e46488) + 115 at main.m:15
frame #66: 0x000000011100d145 libdyld.dylibstart + 1
(lldb)
I have restarted the Mac, but it still happens. Any idea what's causing this?

Related

In pytorch, how to debug the JIT error information "RuntimeError: Only tensors or tuples of tensors can be output from traced functions"?

I wrote a simple pytorch Sequential module for which I plan to convert to ONNX for visualisation & mobile deployment. The first step is to convert it into JIT version:
input = torch.rand(1, 3, 300, 300, dtype=torch.float32, device=device)
mod = FPNImproved(raw)
torch.jit.trace(mod, input)
This step gave me the following error:
for method_name, example_inputs in inputs.items():
# this is needed since Module.__call__ sets up some extra tracing
func = mod if method_name == "forward" else getattr(mod, method_name)
example_inputs = make_tuple(example_inputs)
> module._c._create_method_from_trace(method_name, func, example_inputs, var_lookup_fn, _force_outplace)
E RuntimeError: Only tensors or tuples of tensors can be output from traced functions (getOutput at /opt/conda/conda-bld/pytorch_1570711556059/work/torch/csrc/jit/tracer.cpp:209)
E frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x47 (0x7f35dca71687 in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libc10.so)
E frame #1: torch::jit::tracer::TracingState::getOutput(c10::IValue const&) + 0x365 (0x7f35aa607105 in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libtorch.so)
E frame #2: torch::jit::tracer::exit(std::vector<c10::IValue, std::allocator<c10::IValue> > const&) + 0x3c (0x7f35aa60740c in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libtorch.so)
E frame #3: <unknown function> + 0x57472a (0x7f35e62fd72a in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
E frame #4: <unknown function> + 0x58bbb4 (0x7f35e6314bb4 in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
E frame #5: <unknown function> + 0x206506 (0x7f35e5f8f506 in /home/shared/conda3/envs/cv-torch/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
E frame #6: _PyMethodDef_RawFastCallKeywords + 0x254 (0x56498498e744 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #7: _PyCFunction_FastCallKeywords + 0x21 (0x56498498e861 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #8: _PyEval_EvalFrameDefault + 0x52f8 (0x5649849fa6e8 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #9: _PyEval_EvalCodeWithName + 0x2f9 (0x56498493e539 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #10: _PyFunction_FastCallKeywords + 0x325 (0x56498498def5 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #11: _PyEval_EvalFrameDefault + 0x416 (0x5649849f5806 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #12: _PyEval_EvalCodeWithName + 0x2f9 (0x56498493e539 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #13: _PyFunction_FastCallKeywords + 0x325 (0x56498498def5 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #14: _PyEval_EvalFrameDefault + 0x4b39 (0x5649849f9f29 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #15: _PyFunction_FastCallKeywords + 0xfb (0x56498498dccb in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #16: _PyEval_EvalFrameDefault + 0x416 (0x5649849f5806 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #17: _PyEval_EvalCodeWithName + 0x2f9 (0x56498493e539 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #18: _PyFunction_FastCallDict + 0x400 (0x56498493f860 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #19: _PyObject_Call_Prepend + 0x63 (0x56498495de53 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #20: PyObject_Call + 0x6e (0x564984950dbe in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #21: _PyEval_EvalFrameDefault + 0x1e42 (0x5649849f7232 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #22: _PyEval_EvalCodeWithName + 0x2f9 (0x56498493e539 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #23: _PyFunction_FastCallDict + 0x400 (0x56498493f860 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #24: _PyObject_Call_Prepend + 0x63 (0x56498495de53 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #25: <unknown function> + 0x16ba3a (0x564984995a3a in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #26: _PyObject_FastCallKeywords + 0x49b (0x5649849968fb in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #27: _PyEval_EvalFrameDefault + 0x569f (0x5649849faa8f in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #28: _PyFunction_FastCallKeywords + 0xfb (0x56498498dccb in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #29: _PyEval_EvalFrameDefault + 0x6a3 (0x5649849f5a93 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #30: _PyFunction_FastCallDict + 0x10b (0x56498493f56b in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #31: _PyEval_EvalFrameDefault + 0x1e42 (0x5649849f7232 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #32: _PyEval_EvalCodeWithName + 0xac9 (0x56498493ed09 in /home/shared/conda3/envs/cv-torch/bin/python)
E frame #33: _PyFunction_FastCallKeywords + 0x387 (0x56498498df57 in /home/shared/conda3/envs/cv-torch/bin/python)
Unfortunately this message doesn't help, as I'm under the impression that all the layers in my modules already have tensors or tuples output. Even worse the error message doesn't tell me which layer is the culprit.
What is the recommended way to ask pytorch JIT to explain it? I already enabled PYTORCH_JIT=0.
I'm using pytorch 1.3.0 with only CPU support

xCode & iOS : Debugging with Leaks

I am using Instruments Tool ( Leaks ) to diagnose the leaks, but I don't quite understand how I can backtrack to my codes. Does anyone know how can I further diagnose ?
Using Xcode 4.5 & Profiling on iPad (iOS 4.3.5).
UPDATE: Here is the backtrace :
thread #4: tid = 0x3203, 0x35dffd7a libicucore.A.dylib`utext_hasMetaData + 546, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
frame #0: 0x35dffd7a libicucore.A.dylib`utext_hasMetaData + 546
frame #1: 0x003c17d0
frame #2: 0x35da6746 libicucore.A.dylib`icu::RuleBasedBreakIterator::handleNext(icu::RBBIStateTable const*) + 806
frame #3: 0x35da6406 libicucore.A.dylib`icu::RuleBasedBreakIterator::next() + 82
frame #4: 0x35da5cde libicucore.A.dylib`icu::RuleBasedBreakIterator::following(int) + 218
frame #5: 0x35db0538 libicucore.A.dylib`ubrk_following + 8
frame #6: 0x32bb0bc8 WebCore`WebCore::textBreakFollowing(WebCore::TextBreakIterator*, int) + 8
frame #7: 0x32b9baee WebCore`WebCore::nextBreakablePosition(unsigned short const*, int, int, bool) + 270
frame #8: 0x32bd0dc8 WebCore`WebCore::RenderBlock::findNextLineBreak(WebCore::BidiResolver<WebCore::InlineIterator, WebCore::BidiRun>&, bool, bool&, bool&, bool&, WebCore::EClear*) + 6920
frame #9: 0x32b8ce02 WebCore`WebCore::RenderBlock::layoutInlineChildren(bool, int&, int&) + 1922
frame #10: 0x32b8a1ae WebCore`WebCore::RenderBlock::layoutBlock(bool) + 690
frame #11: 0x32b897c2 WebCore`WebCore::RenderBlock::layout() + 26
frame #12: 0x32b8b956 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, int&, int&) + 414
frame #13: 0x32b8b24c WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, int&) + 428
frame #14: 0x32b8a1bc WebCore`WebCore::RenderBlock::layoutBlock(bool) + 704
frame #15: 0x32b897c2 WebCore`WebCore::RenderBlock::layout() + 26
frame #16: 0x32b8b956 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, int&, int&) + 414
frame #17: 0x32b8b24c WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, int&) + 428
frame #18: 0x32b8a1bc WebCore`WebCore::RenderBlock::layoutBlock(bool) + 704
frame #19: 0x32b897c2 WebCore`WebCore::RenderBlock::layout() + 26
frame #20: 0x32b8b956 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, int&, int&) + 414
frame #21: 0x32b8b24c WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, int&) + 428
frame #22: 0x32b8a1bc WebCore`WebCore::RenderBlock::layoutBlock(bool) + 704
frame #23: 0x32b897c2 WebCore`WebCore::RenderBlock::layout() + 26
frame #24: 0x32b8b956 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, int&, int&) + 414
frame #25: 0x32b8b24c WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, int&) + 428
frame #26: 0x32b8a1bc WebCore`WebCore::RenderBlock::layoutBlock(bool) + 704
frame #27: 0x32b897c2 WebCore`WebCore::RenderBlock::layout() + 26
frame #28: 0x32b8974e WebCore`WebCore::RenderView::layout() + 334
frame #29: 0x32b85cba WebCore`WebCore::FrameView::layout(bool) + 1486
frame #30: 0x32b82c12 WebCore`WebCore::Document::implicitClose() + 794
frame #31: 0x32b828f6 WebCore`WebCore::FrameLoader::checkCallImplicitClose() + 86
frame #32: 0x32b827fe WebCore`WebCore::FrameLoader::checkCompleted() + 134
frame #33: 0x32b82380 WebCore`WebCore::FrameLoader::finishedParsing() + 64
UPDATE : Instruments with Extended Detail. Still not pointing to source. It points to machine code instead.
If you open the extended detail view, you should be able to see the call stack when you select a leak from the detail view. In addition, switching to the call tree view can help you determine where the leaks are occurring in your code. Use the jump bar to switch to the call tree view.
When you switch to the call tree view, you should see a series of checkboxes to the left of the call tree. Selecting the Invert Call Tree and Hide System Libraries checkboxes allow you to find your code in the call tree. Double-clicking one of your functions in the call tree will show you the lines of code that allocate leaked memory.

A DialogViewController with RefreshRequested and EntryElement crash when text entered

A DialogViewController contains an EntryElement and RefreshRequested handler is set (see code below).
Run in the simulator, debug mode, type some quick random text (containing spaces) in the EntryElement. Crash will follow.
What I am doing wrong ?
I guess this is a bug in DialogViewController not retaining some images that is garbage collected.
Is there a switch to trace garbage collector and removed objects ?
the offending code :
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
UINavigationController navController;
DialogViewController dv ;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
navController = new UINavigationController();
var root = new RootElement("Test") {
new Section("Quick type some text") {
new EntryElement("that contains spaces", string.Empty, string.Empty)
}
};
dv = new DialogViewController(root, true);
dv.RefreshRequested += HandleDvRefreshRequested; // comment this line fixes the bug
window.MakeKeyAndVisible ();
if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0)) {
window.RootViewController = navController;
} else {
window.AddSubview (navController.View);
}
return true;
}
void HandleDvRefreshRequested (object sender, EventArgs e)
{
dv.ReloadComplete();
}
}
Starting iOS simulator 5.0
Launching application
Application launched. PID = 4730
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.dll [External]
Thread started:
Loaded assembly: /Users/user/Documents/iphone-cinetoile/Cinetoile.UI2/bin/iPhoneSimulator/Debug/MyApp.exe
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll [External]
Stacktrace:
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MyApp.Application.Main (string[]) [0x00000] in /Users/user/Documents/MyApp/Main.cs:17
at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)
Native stacktrace:
0 MyApp 0x000908ec mono_handle_native_sigsegv + 284
1 MyApp 0x00005c88 mono_sigsegv_signal_handler + 248
2 libSystem.B.dylib 0x9141905b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 ??? 0x92c013ef 0x0 + 2462061551
5 ??? 0x92c011ee 0x0 + 2462061038
6 ??? 0x987a313c 0x0 + 2558144828
7 CoreGraphics 0x91b49e20 CGDataProviderRetain + 22
8 ??? 0x9880c456 0x0 + 2558575702
9 ImageIO 0x9754a0d2 CGImageReadCreateWithProvider + 185
10 ImageIO 0x97549fee CGImageSourceCreateWithDataProvider + 186
11 CoreGraphics 0x013c0d2f CGImageCreateWithPNGDataProvider + 87
12 WebCore 0x073ca2a5 WKGraphicsCreateImageFromBundleWithName + 373
13 WebCore 0x06c1c5bd _ZN7WebCore15GraphicsContext23drawLineForTextCheckingERKNS_10FloatPointEfNS0_21TextCheckingLineStyleE + 369
14 WebCore 0x06cf6e84 _ZN7WebCore13InlineTextBox28paintSpellingOrGrammarMarkerEPNS_15GraphicsContextERKNS_10FloatPointERKNS_14DocumentMarkerEPNS_11RenderStyleERKNS_4FontEb + 1684
15 WebCore 0x06cf6fb9 _ZN7WebCore13InlineTextBox20paintDocumentMarkersEPNS_15GraphicsContextERKNS_10FloatPointEPNS_11RenderStyleERKNS_4FontEb + 297
16 WebCore 0x06cf33fc _ZN7WebCore13InlineTextBox5paintERNS_9PaintInfoEiiii + 6490
17 WebCore 0x06cec3cd _ZN7WebCore13InlineFlowBox5paintERNS_9PaintInfoEiiii + 1065
18 WebCore 0x0724d24c _ZN7WebCore13RootInlineBox5paintERNS_9PaintInfoEiiii + 64
19 WebCore 0x071a8e2a _ZNK7WebCore17RenderLineBoxList5paintEPNS_20RenderBoxModelObjectERNS_9PaintInfoEii + 638
20 WebCore 0x07142089 _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 369
21 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
22 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
23 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
24 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
25 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
26 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
27 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
28 WebCore 0x07141615 _ZN7WebCore11RenderBlock13paintChildrenERNS_9PaintInfoEii + 467
29 WebCore 0x071420ab _ZN7WebCore11RenderBlock11paintObjectERNS_9PaintInfoEii + 403
30 WebCore 0x0714248f _ZN7WebCore11RenderBlock5paintERNS_9PaintInfoEii + 307
31 WebCore 0x071961b0 _ZN7WebCore11RenderLayer10paintLayerEPS0_PNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectEPN3WTF7HashMapIPNS_24OverlapTestRequestClientES4_NS9_7PtrHashISC_EENS9_10HashTraitsISC_EENSF_IS4_EEEEj + 3684
32 WebCore 0x0719648c _ZN7WebCore11RenderLayer10paintLayerEPS0_PNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectEPN3WTF7HashMapIPNS_24OverlapTestRequestClientES4_NS9_7PtrHashISC_EENS9_10HashTraitsISC_EENSF_IS4_EEEEj + 4416
33 WebCore 0x071973bb _ZN7WebCore11RenderLayer5paintEPNS_15GraphicsContextERKNS_7IntRectEjPNS_12RenderObjectE + 101
34 WebCore 0x06bef809 _ZN7WebCore9FrameView13paintContentsEPNS_15GraphicsContextERKNS_7IntRectE + 591
35 WebKit 0x067a51d0 -[WebFrame(WebInternal) _drawRect:contentsOnly:] + 368
36 WebKit 0x067cc83c -[WebHTMLView drawSingleRect:] + 124
37 WebKit 0x067cc786 -[WebHTMLView drawRect:] + 118
38 WebCore 0x07392c2f _ZL12drawCallbackP6WKView6CGRectPv + 95
39 WebCore 0x073cd52c _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 492
40 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
41 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
42 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
43 WebCore 0x073cd61f _ZL11_WKViewDrawP9CGContextP6WKView6CGRectb + 735
44 WebCore 0x073cd80e WKViewDisplayRect + 158
45 WebCore 0x073cead0 WKWindowDrawRect + 48
46 WebCore 0x0735daf0 _ZN7WebCore9TileCache9drawLayerEP9TileLayerP9CGContext + 880
47 WebCore 0x07362af1 -[TileLayer drawInContext:] + 49
48 QuartzCore 0x0417212d _ZL16backing_callbackP9CGContextPv + 88
49 QuartzCore 0x0409215d CABackingStoreUpdate_ + 2636
50 QuartzCore 0x04171fd2 _ZN2CA5Layer8display_Ev + 1370
51 QuartzCore 0x0415fcf1 -[CALayer _display] + 33
52 QuartzCore 0x04166281 _ZN2CA5Layer7displayEv + 165
53 QuartzCore 0x0415fd17 -[CALayer display] + 33
54 QuartzCore 0x04169c5c _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 256
55 QuartzCore 0x040effb9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 395
56 QuartzCore 0x040f1ea6 _ZN2CA11Transaction6commitEv + 374
57 QuartzCore 0x040f1580 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 80
58 CoreFoundation 0x011959ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
59 CoreFoundation 0x0112c670 __CFRunLoopDoObservers + 384
60 CoreFoundation 0x010f84f6 __CFRunLoopRun + 1174
61 CoreFoundation 0x010f7db4 CFRunLoopRunSpecific + 212
62 CoreFoundation 0x010f7ccb CFRunLoopRunInMode + 123
63 GraphicsServices 0x04789879 GSEventRunModal + 207
64 GraphicsServices 0x0478993e GSEventRun + 114
65 UIKit 0x02190a9b UIApplicationMain + 1175
66 ??? 0x0cda47fd 0x0 + 215631869
67 ??? 0x0cc78ea0 0x0 + 214404768
68 ??? 0x0cc78b98 0x0 + 214403992
69 ??? 0x0cc78cee 0x0 + 214404334
70 MyApp 0x00009ff2 mono_jit_runtime_invoke + 722
71 MyApp 0x00169eee mono_runtime_invoke + 126
72 MyApp 0x0016dfd4 mono_runtime_exec_main + 420
73 MyApp 0x001733f5 mono_runtime_run_main + 725
74 MyApp 0x000671f5 mono_jit_exec + 149
75 MyApp 0x002116c9 main + 2825
76 MyApp 0x00003045 start + 53
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
It's a case of Autocorrection strikes back, aka bug #325 (and quite a few duplicates) and it's not MonoTouch specific.
Something, deep down, the simulated iOS gets corrupted and shows up while it wants to draw it's little red line to show something is misspelled.
This will only happen in the simulator and only when an UITextField has auto-correction enabled. Turning it off like this:
new EntryElement("that contains spaces", string.Empty, string.Empty) {
AutocorrectionType = UITextAutocorrectionType.No
}
will solve the issue (and you can do it only for your simulator builds with a #define).

App is crashing in a certain line, Why?

My real code is full of NSLog's,
the following line is the reason for he crash but I don't understand why
NSString *newDir = [documentsDirectory
stringByAppendingPathComponent:file];
Here is the whole method:
- (void)viewDidLoad {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray* newArray= [[NSArray alloc]init];
newArray= [fileManager contentsOfDirectoryAtURL:[NSURL fileURLWithPath:#"/Users/admin/Library/FotoAppFotos/"]
includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey] options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
categories= [NSMutableArray arrayWithArray: newArray];
for(NSString *file in categories) {
NSString *newDir = [documentsDirectory stringByAppendingPathComponent:file]; // in this line the app crashes
[categories addObject:newDir]; //categories
}
[super viewDidLoad];
}
As mentioned the NSLog print of documentsDirectory and file are:
documentsDirectory: /Users/admin/Library/Application Support/iPhone
Simulator/4.3/Applications/D5AB6F90-0420-4A66-B141-D27AB2C11C3C/Documents
file://localhost/Users/admin/Library/FotoAppFotos/Audio/
The whole crash log is:
2011-11-09 09:21:42.989 TestTest[543:207] -[NSURL length]: unrecognized selector sent to instance 0x5c07df0
2011-11-09 09:21:42.992 TestTest[543:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL length]: unrecognized selector sent to instance 0x5c07df0'
*** Call stack at first throw:
(
0 CoreFoundation 0x0102b5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0117f313 objc_exception_throw + 44
2 CoreFoundation 0x0102d0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f9c966 ___forwarding___ + 966
4 CoreFoundation 0x00f9c522 _CF_forwarding_prep_0 + 50
5 Foundation 0x0002b1ad -[NSPathStore2 stringByAppendingPathComponent:] + 211
6 TestTest 0x00003244 -[Produktpalette viewDidLoad] + 535
7 UIKit 0x0036f089 -[UIViewController view] + 179
8 UIKit 0x0060ca40 -[UIPopoverController _setupIncomingViewController:presenting:animated:] + 143
9 UIKit 0x0060be26 -[UIPopoverController initWithContentViewController:] + 321
10 TestTest 0x00002540 -[TestTestViewController produktpalette:] + 151
11 UIKit 0x002bf4fd -[UIApplication sendAction:to:from:forEvent:] + 119
12 UIKit 0x004d1cc3 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
13 UIKit 0x002bf4fd -[UIApplication sendAction:to:from:forEvent:] + 119
14 UIKit 0x0034f799 -[UIControl sendAction:to:forEvent:] + 67
15 UIKit 0x00351c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
16 UIKit 0x003507d8 -[UIControl touchesEnded:withEvent:] + 458
17 UIKit 0x002e3ded -[UIWindow _sendTouchesForEvent:] + 567
18 UIKit 0x002c4c37 -[UIApplication sendEvent:] + 447
19 UIKit 0x002c9f2e _UIApplicationHandleEvent + 7576
20 GraphicsServices 0x01983992 PurpleEventCallback + 1550
21 CoreFoundation 0x0100c944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x00f6ccf7 __CFRunLoopDoSource1 + 215
23 CoreFoundation 0x00f69f83 __CFRunLoopRun + 979
24 CoreFoundation 0x00f69840 CFRunLoopRunSpecific + 208
25 CoreFoundation 0x00f69761 CFRunLoopRunInMode + 97
26 GraphicsServices 0x019821c4 GSEventRunModal + 217
27 GraphicsServices 0x01982289 GSEventRun + 115
28 UIKit 0x002cdc93 UIApplicationMain + 1160
29 TestTest 0x00001c2a main + 84
30 TestTest 0x00001bcd start + 53
)
terminate called after throwing an instance of 'NSException'
Thank you for any help and presumption in advance
The hint comes from:
[NSURL length]: unrecognized selector sent to instance
If you are working on iOS, sorry to tell that :
This method is unimplemented in iOS, so it performs no operation.
Somebody has similar problem .

Core Data delete exception

I am trying to clean up the objects which has status uncompleted. Then I got delete exception while delete these objects from Core Data. Could you help me to point out mistakes? Thanks
Here is the code:
- (void) cleanDownloadQueue {
NSMutableArray *cleanedAssetFiles = [[NSMutableArray alloc] init];
//get objects from context
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[self AssetFileEntityDescription]];
NSString *name = #"downloadStatus";
NSInteger value = COMPLETED;
NSPredicate *predicate =[NSPredicate predicateWithFormat:#"%K != %i",name,value];
[fetchRequest setPredicate:predicate];
NSArray *results = [[self.managedObjectContext executeFetchRequest:fetchRequest error:&error] mutableCopy];
//NSLog(#"current length results length: %i", [results count]);
if ([results count] > 0) {
for (NSObject *obj in results){
if ([obj isKindOfClass:[AssetFile class]]) {
AssetFile *assetFile = (AssetFile *) obj;
//assetFile.srAsset.assetFile = nil;
[cleanedAssetFiles addObject:assetFile];
}
}
}
[fetchRequest release];
[results release];
for (AssetFile *afile in cleanedAssetFiles) {
[self.managedObjectModel delete:afile];
}
if ([cleanedAssetFiles count] > 0) {
[self saveManagedObjectChanges];
}
[cleanedAssetFiles release];
}
And here is the log:
<Error>: -[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0
May 19 21:57:10 unknown DMC to Go[1182] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0'
*** Call stack at first throw:
(
0 CoreFoundation 0x32a9d64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x35475c5d objc_exception_throw + 24
2 CoreFoundation 0x32aa11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x32aa0649 ___forwarding___ + 508
4 CoreFoundation 0x32a17180 _CF_forwarding_prep_0 + 48
5 DMC to Go 0x0000483f -[dmcIpadAppDelegate cleanDownloadQueue] + 934
6 DMC to Go 0x0001b617 +[DmcIpadAppDelegate cleanDownloadQueue] + 82
7 DMC to Go 0x0000b35d -[SRListViewController viewDidLoad] + 40
8 UIKit 0x3262cf0f -[UIViewController view] + 110
9 UIKit 0x3263b5ef -[UIViewController contentScrollView] + 22
10 UIKit 0x3263b45f -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 30
11 UIKit 0x3263b35d -[UINavigationController _layoutViewController:] + 24
12 UIKit 0x3263ae35 -[UINavigationController _startTransition:fromViewController:toViewController:] + 380
13 UIKit 0x3263ac43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
14 UIKit 0x3263ab87 -[UINavigationController viewWillLayoutSubviews] + 14
15 UIKit 0x3263ab23 -[UILayoutContainerView layoutSubviews] + 138
16 UIKit 0x325fb5fb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
17 CoreFoundation 0x32a0af03 -[NSObject(NSObject) performSelector:withObject:] + 22
18 QuartzCore 0x35f3bbb5 -[CALayer layoutSublayers] + 120
19 QuartzCore 0x35f3b96d CALayerLayoutIfNeeded + 184
20 QuartzCore 0x35f3b8a7 -[CALayer layoutIfNeeded] + 78
21 UIKit 0x325fb5d7 -[UIView(Hierarchy) layoutIfNeeded] + 22
22 UIKit 0x326a3775 -[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:] + 356
23 UIKit 0x326a2bc1 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 3100
24 UIKit 0x326a6677 -[UIWindow _setRotatableViewOrientation:duration:force:] + 54
25 UIKit 0x3263a8eb -[UIWindow _updateToInterfaceOrientation:duration:force:] + 74
26 UIKit 0x32639551 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 540
27 UIKit 0x326390ad -[UIWindow setDelegate:] + 168
28 UIKit 0x32638fa9 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 64
29 UIKit 0x32637611 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 460
30 UIKit 0x326165a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506
31 UIKit 0x3261632f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106
32 UIKit 0x325fbc1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678
33 UIKit 0x325fb96b -[UIView(Hierarchy) addSubview:] + 22
34 UIKit 0x3262b35f -[UIWindow addRootViewControllerViewIfPossible] + 202
35 UIKit 0x3275653f -[UIWindow setRootViewController:] + 166
36 DMC to Go 0x00003055 -[dmcIpadAppDelegate application:didFinishLaunchingWithOptions:] + 792
37 UIKit 0x3262b821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
38 UIKit 0x32625b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
39 UIKit 0x325fa7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
40 UIKit 0x325fa215 -[UIApplication sendEvent:] + 44
41 UIKit 0x325f9c53 _UIApplicationHandleEvent + 5090
42 GraphicsServices 0x358d2e77 PurpleEventCallback + 666
43 CoreFoundation 0x32a74a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
44 CoreFoundation 0x32a7683f __CFRunLoopDoSource1 + 166
45 CoreFoundation 0x32a7760d __CFRunLoopRun + 520
46 CoreFoundation 0x32a07ec3 CFRunLoopRunSpecific + 230
47 CoreFoundation 0x32a07dcb CFRunLoopRunInMode + 58
48 UIKit 0x32624d49 -[UIApplication _run] + 372
49 UIKit 0x32622807 UIApplicationMain + 670
50 DMC to Go 0x00002927 main + 82
51 DMC to Go 0x000028d0 start + 40
You can not delete objects with your managedObjectModel.
Only the managedObjectContext can delete objects:
for (AssetFile *afile in cleanedAssetFiles) {
[afile.managedObjectContext delete:afile];
}

Resources