my application is crashing when I enter an ' (apostrophe) in the textfield. Can anyone please tell the solution for the problem. Below is the place where it crashes
hotelTextfield.text = [hotelList objectAtIndex:indexPath.row];
I entered other strings in the textfield but those didn't cause any issue. But whenever I enter some ', it crashes.
Please find the stack backtrace for the crash
Program received signal: “EXC_BAD_ACCESS”.
(gdb) bt
#0 0x31ec3ebc in objc_msgSend ()
#1 0x31ec5b3c in objc_setProperty ()
#2 0x0000e720 in -[AvailabilityVC setHotelList:] (self=0x11fbe0, _cmd=0x1f700, _value=0x31ec3f28) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/Classes/AvailabilityVC.m:29
#3 0x0000c6c8 in -[AvailabilityVC textFieldDidChange:] (self=0x11fbe0, _cmd=0x1f8e7, aNotification=0x1858a0) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/Classes/AvailabilityVC.m:248
#4 0x308ff5d8 in _nsnote_callback ()
#5 0x30de3510 in _CFXNotificationPostNotification ()
#6 0x308fd1b2 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#7 0x308ff518 in -[NSNotificationCenter postNotificationName:object:] ()
#8 0x336b27f4 in -[UITextField fieldEditorDidChange:] ()
#9 0x335eecb4 in -[UIFieldEditor webViewDidChange:] ()
#10 0x308ff5d8 in _nsnote_callback ()
#11 0x30de3510 in _CFXNotificationPostNotification ()
#12 0x308fd1b2 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#13 0x30da38e4 in __invoking___ ()
#14 0x30df757a in -[NSInvocation invoke] ()
#15 0x311ca134 in SendDelegateMessage ()
#16 0x3069cb30 in WebEditorClient::respondToChangedContents ()
#17 0x3123c01c in WebCore::Editor::respondToChangedContents ()
#18 0x3123a914 in WebCore::Editor::appliedEditing ()
#19 0x3123a740 in WebCore::TypingCommand::typingAddedToOpenCommand ()
#20 0x3122aa10 in WebCore::TypingCommand::insertTextRunWithoutNewlines ()
#21 0x3122a954 in WebCore::TypingCommand::insertText ()
#22 0x3122947c in WebCore::TypingCommand::insertText ()
#23 0x31228bd4 in WebCore::Editor::insertTextWithoutSendingTextEvent ()
#24 0x31228818 in WebCore::EventHandler::defaultTextInputEventHandler ()
#25 0x311f776c in WebCore::EventTargetNode::defaultEventHandler ()
#26 0x311f7358 in WebCore::EventTargetNode::dispatchGenericEvent ()
#27 0x311f6cf8 in WebCore::EventTargetNode::dispatchEvent ()
#28 0x312284fc in WebCore::EventHandler::handleTextInputEvent ()
#29 0x312283e0 in WebCore::Editor::insertText ()
#30 0x3069bab8 in -[WebHTMLView(WebNSTextInputSupport) insertText:] ()
#31 0x30defa14 in -[NSObject performSelector:withObject:] ()
#32 0x31228280 in -[WAKResponder tryToPerform:with:] ()
#33 0x3069b3d0 in -[WebView(WebViewEditingActions) _performResponderOperation:with:] ()
#34 0x3069b350 in -[WebView(WebViewEditingActions) insertText:] ()
#35 0x3368dd2c in -[UIWebDocumentView insertText:] ()
#36 0x3368d7b0 in -[UIKeyboardImpl addInputString:fromVariantKey:] ()
#37 0x3368ca88 in -[UIKeyboardImpl handleStringInput:fromVariantKey:] ()
#38 0x3368c81c in -[UIKeyboardLayoutStar sendStringAction:forKey:] ()
#39 0x3368b8f0 in -[UIKeyboardLayoutStar touchUp:withPathInfo:] ()
#40 0x3368732c in -[UIKeyboardLayout handleHandEvent:] ()
#41 0x3368b414 in -[UIKeyboardLayout touchesEnded:withEvent:] ()
#42 0x33604900 in -[UIWindow _sendTouchesForEvent:] ()
#43 0x33603f94 in -[UIWindow sendEvent:] ()
#44 0x335ff790 in -[UIApplication sendEvent:] ()
#45 0x335ff094 in _UIApplicationHandleEvent ()
#46 0x332e8990 in PurpleEventCallback ()
#47 0x30de952a in CFRunLoopRunSpecific ()
#48 0x30de8c1e in CFRunLoopRunInMode ()
#49 0x332e7374 in GSEventRunModal ()
#50 0x335adc30 in -[UIApplication _run] ()
#51 0x335ac230 in UIApplicationMain ()
#52 0x00002550 in main (argc=1, argv=0x2ffff540) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/main.m:13
(gdb)
OK, the problem is solved. It was due to the SQLite. the Sqlite wasn't able to handle the apostrophe('). Solved it by adding an extra ' before sending it to the SQLite.
Related
I'm trying to present info about a CKShare to a user. You can do this as follows:
let container: CKContainer = /* existing CKContainer */
let share: CKShare = /* existing CKShare */
let item = NSItemProvider()
item.registerCloudKitShare(share, container: container)
let sharingService = NSSharingService(named: .cloudSharing)
sharingService.perform(withItems: [item])
This correctly opens the window:
However, I cannot click anything in the window, and after closing the window I cannot click anything in my app.
EDIT: after further investigation, I realized I can navigate the UI using the keyboard. However, it is still quite buggy (triggering Done or pressing esc dismisses the view controller but doesn't close the window, and throws an NSInternalInconsistencyException)
The stack trace (below) shows that the main thread is waiting for events in the modal event loop:
#0 0x00007fff7de8b20a in mach_msg_trap ()
#1 0x00007fff7de8a724 in mach_msg ()
#2 0x00007fff55ef9785 in __CFRunLoopServiceMachPort ()
#3 0x00007fff55ef8ad7 in __CFRunLoopRun ()
#4 0x00007fff55ef8153 in CFRunLoopRunSpecific ()
#5 0x00007fff551e2d96 in RunCurrentEventLoopInMode ()
#6 0x00007fff551e2b06 in ReceiveNextEventCommon ()
#7 0x00007fff551e2884 in _BlockUntilNextEventMatchingListInModeWithFilter ()
#8 0x00007fff53493a73 in _DPSNextEvent ()
#9 0x00007fff53c29e34 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
#10 0x00007fff536c5e7b in -[NSApplication _doModalLoop:peek:] ()
#11 0x00007fff538aac9f in __35-[NSApplication runModalForWindow:]_block_invoke_2 ()
#12 0x00007fff538aac4c in __35-[NSApplication runModalForWindow:]_block_invoke ()
#13 0x00007fff53d59219 in _NSTryRunModal ()
#14 0x00007fff536c3911 in -[NSApplication runModalForWindow:] ()
#15 0x00007fff53fc4289 in __87-[_NSCloudSharingService _showParticipantListServiceInSheetAttachedToWindow:withItems:]_block_invoke ()
#16 0x00007fff7a9ef0f4 in -[NSRemoteView _completeAdvanceToRunPhase:withError:] ()
#17 0x00007fff7a9d3c69 in __35-[NSRemoteView _advanceToRunPhase:]_block_invoke.1071 ()
#18 0x00007fff55ef5bec in __invoking___ ()
#19 0x00007fff55ef5ac0 in -[NSInvocation invoke] ()
#20 0x00007fff7aa172d2 in withHintInProgress ()
#21 0x00007fff7a98e792 in __deferNSXPCInvocationOntoMainThread_block_invoke ()
#22 0x00007fff7aa1cb9d in __wrapBlockWithVoucher_block_invoke ()
#23 0x00007fff7a98e36f in __deferBlockOntoMainThread_block_invoke_2 ()
#24 0x00007fff55f1687c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#25 0x00007fff55ef9253 in __CFRunLoopDoBlocks ()
#26 0x00007fff55ef9018 in __CFRunLoopRun ()
#27 0x00007fff55ef8153 in CFRunLoopRunSpecific ()
#28 0x00007fff7aa1690e in __invokeRunLoopInModeForDuration_block_invoke_2 ()
#29 0x00007fff7aa16862 in invokeRunLoopInModeForDuration ()
#30 0x00007fff7a9f371b in __29-[NSCFRunLoopSemaphore wait:]_block_invoke_2 ()
#31 0x00007fff7a9f3641 in __29-[NSCFRunLoopSemaphore wait:]_block_invoke ()
#32 0x00007fff7a9f2aac in +[NSCFRunLoopSemaphore _observe:whilePerforming:] ()
#33 0x00007fff7a9f332e in -[NSCFRunLoopSemaphore wait:] ()
#34 0x00007fff7a9cb9ed in -[NSRemoteViewSemaphore wait:] ()
#35 0x00007fff7a9d43db in -[NSRemoteView _waitOnSemaphore:] ()
#36 0x00007fff7a9e95a6 in -[NSRemoteView _didSetOriginOrSize:] ()
#37 0x00007fff7a9e9a7f in -[NSRemoteView setFrameSize:] ()
#38 0x00007fff7aa146e9 in withImplicitAnimation ()
#39 0x00007fff7a9e0184 in -[NSRemoteView _serviceRequestsResize:completion:] ()
#40 0x00007fff7a9e093e in -[NSRemoteView _serviceRequestsResize:animate:transaction:completion:] ()
#41 0x00007fff7a993ec4 in -[NSRemoteViewMarshal serviceRequestsResize:animate:transaction:completion:] ()
#42 0x00007fff55ef5bec in __invoking___ ()
#43 0x00007fff55ef5ac0 in -[NSInvocation invoke] ()
#44 0x00007fff7aa172d2 in withHintInProgress ()
#45 0x00007fff7a98e83e in __deferNSXPCInvocationOntoMainThread_block_invoke ()
#46 0x00007fff7aa1cb9d in __wrapBlockWithVoucher_block_invoke ()
#47 0x00007fff7a98e36f in __deferBlockOntoMainThread_block_invoke_2 ()
#48 0x00007fff55f1687c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#49 0x00007fff55ef9253 in __CFRunLoopDoBlocks ()
#50 0x00007fff55ef9018 in __CFRunLoopRun ()
#51 0x00007fff55ef8153 in CFRunLoopRunSpecific ()
#52 0x00007fff551e2d96 in RunCurrentEventLoopInMode ()
#53 0x00007fff551e2b06 in ReceiveNextEventCommon ()
#54 0x00007fff551e2884 in _BlockUntilNextEventMatchingListInModeWithFilter ()
#55 0x00007fff53493a73 in _DPSNextEvent ()
#56 0x00007fff53c29e34 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
#57 0x00007fff53488885 in -[NSApplication run] ()
#58 0x00007fff53457a72 in NSApplicationMain ()
#59 0x000000010000d831 in main() at main.swift:25
#60 0x000000010000d324 in main at main.swift:28
#61 0x00007fff7dd44015 in start ()
#62 0x00007fff7dd44015 in start ()
Does anyone know how to fix this issue?
Had the same problem in an Objective-C project and found I needed to use the NSSharingServiceDelegate method to return the source Window.
- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope{
return self.view.window;
}
https://developer.apple.com/documentation/appkit/nssharingservicedelegate/1402679-sharingservice
[NSSharingService performWithItems:NSArrayOfItems]; on the main thread would then present a sheet that functions correctly.
If from the owners privateCloudDatabase you would be presented all participants with sharing options, and like your screenshot, reduced participant options including ‘Remove Me’ if the shared record resides in the sharedCloudDatabase.
I am trying to run VAFieldTest application in my device, but the application got crashed at this line _CTServerConnectionRegisterForNotification. How can I fix this crash?
Here are the parameters I have passed:
CTServerConnectionRef conn;
void register_notification(){
if (!mach_port || !conn) return;
void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LOCAL | RTLD_LAZY);
void *kCTCellMonitorUpdateNotification = dlsym(libHandle, "kCTIndicatorsSignalStrengthNotification");
if( kCTCellMonitorUpdateNotification== NULL) NSLog(#"Could not find kCTCellMonitorUpdateNotification");
int x = 0; //placehoder for callback
_CTServerConnectionRegisterForNotification(conn,kCTCellMonitorUpdateNotification,(void*)&x);
}
Here is the crash report:
(gdb) bt
#0 0x344f9710 in __CFStrConvertBytesToUnicode ()
#1 0x344faaea in __CFStringEncodeByteStream ()
#2 0x34466a10 in CFStringGetBytes ()
#3 0x39123928 in ctu::cf::assign ()
#4 0x39112380 in getCTEventForNotification ()
#5 0x390ecff8 in _CTServerConnectionDaemonRegistration ()
#6 0x39112e12 in _CTServerConnectionRegisterForNotification ()
#7 0x00003138 in register_notification () at /Users/deepthi/Desktop/iPhone Agent/VAFieldTest-master/Classes/VAFieldTestViewController.m:66
#8 0x00003388 in -[VAFieldTestViewController viewDidLoad] (self=0x15ada0, _cmd=0x34b8581b) at /Users/deepthi/Desktop/iPhone Agent/VAFieldTest-master/Classes/VAFieldTestViewController.m:116
#9 0x3471458c in -[UIViewController loadViewIfRequired] ()
#10 0x00002d84 in -[VAFieldTestAppDelegate application:didFinishLaunchingWithOptions:] (self=0x11f350, _cmd=0x34b698d3, application=0x11e510, launchOptions=0x0) at /Users/deepthi/Desktop/iPhone Agent/VAFieldTest-master/Classes/VAFieldTestAppDelegate.m:22
#11 0x34755ad0 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#12 0x3475565a in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#13 0x3474d842 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#14 0x346f5c38 in -[UIApplication handleEvent:withNewEvent:] ()
#15 0x346f56cc in -[UIApplication sendEvent:] ()
#16 0x346f511a in _UIApplicationHandleEvent ()
#17 0x394785a2 in _PurpleEventCallback ()
#18 0x344e9682 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#19 0x344e8ee8 in __CFRunLoopDoSources0 ()
#20 0x344e7cb6 in __CFRunLoopRun ()
#21 0x3445aebc in CFRunLoopRunSpecific ()
#22 0x3445ad48 in CFRunLoopRunInMode ()
#23 0x3474c47c in -[UIApplication _run] ()
#24 0x347492f8 in UIApplicationMain ()
#25 0x00002cf6 in main (argc=1, argv=0x2fdffc50) at /Users/deepthi/Desktop/iPhone Agent/VAFieldTest-master/main.m:15
(gdb)
When I got this, it was caused by the 3rd argument in the call to _CTServerConnectionRegisterForNotification(...) which should be a pointer to a callback...described here - incompactable pointer type passing int to parameter of type void(*)(void) in coretelephony obj c
Iphone simulator crash in thread 7 (web thread), app use webview, interact with other views using phoneGap.
Based on XCode 4.2.
#0 0x05841d8a in WebCore::ApplicationCacheGroup::disassociateDocumentLoader ()
#1 0x056879fa in WebCore::ApplicationCacheHost::~ApplicationCacheHost ()
#2 0x0568714f in WebCore::DocumentLoader::~DocumentLoader ()
#3 0x053decb0 in WebDocumentLoaderMac::~WebDocumentLoaderMac ()
#4 0x0579f405 in WebCore::FrameLoader::detachViewsAndDocumentLoader ()
#5 0x0577a542 in WebCore::FrameLoader::detachFromParent ()
#6 0x054414d1 in -[WebView(WebPrivate) _close] ()
#7 0x0459567d in __invoking___ ()
#8 0x04595551 in -[NSInvocation invoke] ()
#9 0x055983c3 in HandleAPISource ()
#10 0x0460601f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#11 0x0456419d in __CFRunLoopDoSources0 ()
#12 0x04563786 in __CFRunLoopRun ()
#13 0x04563240 in CFRunLoopRunSpecific ()
#14 0x04563161 in CFRunLoopRunInMode ()
#15 0x05659423 in RunWebThread ()
#16 0x98305259 in _pthread_start ()
#17 0x983050de in thread_start ()
My app crashes only in simulator , it doesn't crash on device.
it crashes in simulator and gives me nothing except this :
#0 0x00000000 in 0x00000000 ()
#1 0x0182966e in icu::RuleBasedBreakIterator::handleNext ()
#2 0x018293dc in icu::RuleBasedBreakIterator::next() ()
#3 0x01828a12 in icu::RuleBasedBreakIterator::following(int) ()
#4 0x043378dd in WebCore::nextBreakablePosition(unsigned short const*, int, int, bool) ()
#5 0x04cc2fca in -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:] ()
#6 0x04cc07be in -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:] ()
#7 0x04cc0499 in -[NSString(WebStringDrawing) _web_drawInRect:withFont:ellipsis:alignment:lineSpacing:includeEmoji:truncationRect:measureOnly:] ()
#8 0x04cc021b in -[NSString(WebStringDrawing) _web_sizeInRect:withFont:ellipsis:lineSpacing:] ()
#9 0x0053fc33 in -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:lineSpacing:] ()
#10 0x00644987 in -[UILabel _drawTextInRect:baselineCalculationOnly:] ()
#11 0x006422fc in -[UILabel drawTextInRect:] ()
#12 0x00559187 in -[UIView(CALayerDelegate) drawLayer:inContext:] ()
#13 0x00221b5e in -[CALayer drawInContext:] ()
#14 0x0022de47 in backing_callback(CGContext*, void*) ()
#15 0x0017b1f7 in CABackingStoreUpdate ()
#16 0x0022dd24 in -[CALayer _display] ()
#17 0x0022427d in CALayerDisplayIfNeeded ()
#18 0x001c90c3 in CA::Context::commit_transaction(CA::Transaction*) ()
#19 0x001ca294 in CA::Transaction::commit() ()
#20 0x001ca555 in CA::Transaction::release_thread(void*) ()
#21 0x98f4de0c in _pthread_tsd_cleanup ()
#22 0x98f0664c in _pthread_exit ()
#23 0x98f069a0 in pthread_exit ()
#24 0x00c93d1a in -[NSString compare:options:] ()
#25 0x00c93c98 in __NSThread__main__ ()
#26 0x98f04ed9 in _pthread_start ()
#27 0x98f086de in thread_start ()
Why is this happening?
Thanks.
Set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:
(gdb) info malloc-history 0x543216
Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.
See this article for more detailed instructions.
Another idea is to try turning off auto-correction in the simulator Settings App.
Can anyone help in analysing this crash issue?
The program did receive memory warning when webview was opened.
2011-05-10 10:52:44.882 [17713:207] *** -[CALayer retain]: message sent to deallocated instance 0xd0ee720
(gdb) where
#0 0x017d7057 in ___forwarding___ ()
#1 0x017d6f22 in __forwarding_prep_0___ ()
#2 0x017780bc in CFRetain ()
#3 0x0185edb5 in +[__NSArrayI __new::] ()
#4 0x013328f6 in -[CALayerArray copyWithZone:] ()
#5 0x017c67ca in -[NSObject(NSObject) copy] ()
#6 0x007378d7 in -[UIView dealloc] ()
#7 0x007ac52a in -[UIViewController setView:] ()
#8 0x007aeeec in -[UIViewController unloadViewForced:] ()
#9 0x007aab0a in -[UIViewController unloadViewIfReloadable] ()
#10 0x007b6194 in -[UINavigationController purgeMemoryForReason:] ()
#11 0x007aa15b in -[UIViewController didReceiveMemoryWarning] ()
#12 0x004686c1 in _nsnote_callback ()
#13 0x0183df99 in __CFXNotificationPost_old ()
#14 0x017bd33a in _CFXNotificationPostNotification ()
#15 0x0045e266 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#16 0x0046a5a9 in -[NSNotificationCenter postNotificationName:object:] ()
#17 0x00703108 in -[UIApplication _performMemoryWarning] ()
#18 0x0181724c in __CFNotificationCenterDarwinCallBack ()
#19 0x017a7872 in __CFMachPortPerform ()
#20 0x01847064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#21 0x017a76f7 in __CFRunLoopDoSource1 ()
#22 0x017a4983 in __CFRunLoopRun ()
#23 0x017a4240 in CFRunLoopRunSpecific ()
#24 0x017a4161 in CFRunLoopRunInMode ()
#25 0x01daa268 in GSEventRunModal ()
#26 0x01daa32d in GSEventRun ()
#27 0x0070d42e in UIApplicationMain ()
#28 0x0000272e in main (argc=1, argv=0xbfffee7c)
You are trying to access a CALayer object that has already been released. Make sure you release the objects properly. Also ensure that [super dealloc]; is not called before other objects are released