Error interacting with the map in the simulator - swift

Help
There is an error:
2017-09-13 11:21:04.405 Seer[1413:69626] *** Terminating app due to
uncaught exception 'GMSThreadException', reason: 'The API method must
be called from the main thread'
*** First throw call stack:
(
0 CoreFoundation 0x000000010bb30b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010aef2141 objc_exception_throw + 48
2 CoreFoundation 0x000000010bb99625 +[NSException raise:format:] + 197
3 Seer 0x0000000104638ed2 -[GMSMapView clear] + 97
4 Seer 0x000000010461a4ff _TFC4Seer14ViewController12markercreatefT_T_ + 159
5 Seer 0x000000010461950f _TFFC4Seer14ViewController9outputphpFT_T_U_FTGSqV10Foundation4Data_GSqCSo11URLResponse_GSqPs5Error___T_ + 2927
6 Seer 0x00000001046178db _TTRXFo_oGSqV10Foundation4Data_oGSqCSo11URLResponse_oGSqPs5Error____XFdCb_dGSqCSo6NSData_dGSqS1__dGSqCSo7NSError___ + 203
7 CFNetwork 0x000000010b3bd87b __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 19
8 CFNetwork 0x000000010b3bd095 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 143
9 Foundation 0x000000010a9fc3b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
10 Foundation 0x000000010a9fc0bb -[NSBlockOperation main] + 101
11 Foundation 0x000000010a9fa877 -[__NSOperationInternal _start:] + 627
12 Foundation 0x000000010a9f65fc __NSOQSchedule_f + 198
13 libdispatch.dylib 0x000000010caa905c _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000010ca8794f _dispatch_queue_serial_drain + 221
15 libdispatch.dylib 0x000000010ca88669 _dispatch_queue_invoke + 1084
16 libdispatch.dylib 0x000000010ca8aec4 _dispatch_root_queue_drain + 634
17 libdispatch.dylib 0x000000010ca8abef _dispatch_worker_thread3 + 123
18 libsystem_pthread.dylib 0x000000010ce405a2 _pthread_wqthread + 1299
19 libsystem_pthread.dylib 0x000000010ce4007d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type
NSException
(lldb)
in the simulator when interacting with the map, for example when creating markers:
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: catlatlon[index][1], longitude: catlatlon[index][2])
marker.title = "Муляж Камеры | ID: \(Int(catlatlon[index][3]))"
marker.snippet = "Дата: \(catstring[index])"
marker.icon = self.imageWithImage(image: #imageLiteral(resourceName: "ic_fake.png"), scaledToSize: CGSize(width: 28.0, height: 48.0)) // муляж камеры
marker.map = self.mMap
But on a real device everything works well.
I would leave it as it is. But I'm afraid when testing the application by moderators the AppStore, will show this error and they will not publish my application

Related

Terminating app due to uncaught exception 'NSInternalInconsistencyException' reason: 'PushKit'

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'PushKit apps that use VoIP push must link either CallKit or IncomingCallNotifications frameworks.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23baa1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50864b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23ba9f68 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff25614de9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 PushKit 0x00007fff2af1896f +[PKPushRegistry _checkIfNecessaryVoIPFrameworksAreLinked] + 251
5 PushKit 0x00007fff2af18cdc -[PKPushRegistry _registerForPushType:] + 287
6 PushKit 0x00007fff2af1975f __38-[PKPushRegistry setDesiredPushTypes:]_block_invoke + 240
7 libdispatch.dylib 0x000000010b470d6c _dispatch_client_callout + 8
8 libdispatch.dylib 0x000000010b47f9fd _dispatch_lane_barrier_sync_invoke_and_complete + 132
9 PushKit 0x00007fff2af1964e -[PKPushRegistry setDesiredPushTypes:] + 108
10 Office Phone 0x0000000109752139 $s12Office_Phone18MainViewControllerC5coderACSgSo7NSCoderC_tcfc + 2857
11 Office Phone 0x00000001097524e3 $s12Office_Phone18MainViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 51
12 UIKitCore 0x00007fff471e7350 -[UIClassSwapper initWithCoder:] + 2427
13 UIFoundation 0x00007fff46a37cd6 UINibDecoderDecodeObjectForValue + 744
14 UIFoundation 0x00007fff46a379e1 -[UINibDecoder decodeObjectForKey:] + 251
15 UIKitCore 0x00007fff471eb657 -[UIRuntimeConnection initWithCoder:] + 125
16 UIFoundation 0x00007fff46a37cd6 UINibDecoderDecodeObjectForValue + 744
17 UIFoundation 0x00007fff46a37f7d UINibDecoderDecodeObjectForValue + 1423
18 UIFoundation 0x00007fff46a379e1 -[UINibDecoder decodeObjectForKey:] + 251
19 UIKitCore 0x00007fff471e641e -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 450
20 UIKitCore 0x00007fff471e918d -[UINib instantiateWithOwner:options:] + 1145
21 UIKitCore 0x00007fff476db470 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 279
22 Office Phone 0x000000010976d750 $s12Office_Phone11AppDelegateC21selectVCToBedisplayed2vcySo16UIViewControllerCSg_tF + 464
23 Office Phone 0x000000010976d38f $s12Office_Phone11AppDelegateC22setUpInitialRootScreenyyF + 511
24 Office Phone 0x00000001097708ec $s12Office_Phone11AppDelegateC22requestForVerifyDeviceyyFy9Alamofire12DataResponseVyypGcfU_ + 2828
25 Alamofire 0x0000000109b72591 $s9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0CSg_xyAA0B8ResponseVy16SerializedObjectQzGctAA0bkF8ProtocolRzlFyycfU_yycfU_ + 369
26 Alamofire 0x0000000109b2c22d $sIeg_IeyB_TR + 45
27 libdispatch.dylib 0x000000010b46fdf8 _dispatch_call_block_and_release + 12
28 libdispatch.dylib 0x000000010b470d6c _dispatch_client_callout + 8
29 libdispatch.dylib 0x000000010b47ee24 _dispatch_main_queue_callback_4CF + 1500
30 CoreFoundation 0x00007fff23b0ce49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
31 CoreFoundation 0x00007fff23b07aa9 __CFRunLoopRun + 2329
32 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438
33 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65
34 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621
35 Office Phone 0x000000010977320b main + 75
36 libdyld.dylib 0x00007fff516ecd29 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
You need to import CallKit Framework in your project Framework,Libraries, and Embeded Content section.

[SPApplication _accessibilityInitialize]: unrecognized selector sent to instance on watchOS4

Once my watch app starts, it crashes with the following error:
2017-08-17 13:59:54.304792-0300 watchOS4 Extension[11500:1617313] -[SPApplication _accessibilityInitialize]: unrecognized selector sent to instance 0x79e5b8f0
2017-08-17 13:59:56.173675-0300 watchOS4 Extension[11500:1617313] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SPApplication _accessibilityInitialize]: unrecognized selector sent to instance 0x79e5b8f0'
*** First throw call stack:
(
0 CoreFoundation 0x015ae80d __exceptionPreprocess + 189
1 libobjc.A.dylib 0x00f22bcf objc_exception_throw + 49
2 CoreFoundation 0x0162f978 -[NSObject(NSObject) doesNotRecognizeSelector:] + 136
3 CoreFoundation 0x015322c4 ___forwarding___ + 1300
4 CoreFoundation 0x01531d8e _CF_forwarding_prep_0 + 14
5 UIAccessibility 0x19a13e2c __54+[UIAccessibilityLoader _accessibilityLoadSubbundles:]_block_invoke.338 + 44
6 libdispatch.dylib 0x05f990bf _dispatch_call_block_and_release + 15
7 libdispatch.dylib 0x05f9a42c _dispatch_client_callout + 14
8 libdispatch.dylib 0x05fa4e88 _dispatch_main_queue_callback_4CF + 1204
9 CoreFoundation 0x0157116e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
10 CoreFoundation 0x0153677e __CFRunLoopRun + 3310
11 CoreFoundation 0x015357e5 CFRunLoopRunSpecific + 373
12 CoreFoundation 0x0153565a CFRunLoopRunInMode + 122
13 GraphicsServices 0x08fde249 GSEventRunModal + 71
14 GraphicsServices 0x08fde12e GSEventRun + 80
15 UIKit 0x01a402d1 UIApplicationMain + 148
16 libxpc.dylib 0x06350a67 _xpc_objc_main + 528
17 libxpc.dylib 0x063533a0 xpc_main + 158
18 Foundation 0x009543c5 -[NSXPCListener resume] + 185
19 PlugInKit 0x057be28b -[PKService run] + 799
20 WatchKit 0x001cd123 main + 160
21 libdyld.dylib 0x05ffdd41 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
What does the SPApplication _accessibilityInitialize means? I do not implement any accessibility functionality yet.
Im running watchOS4 beta 6 and XCode 9 beta 5
For who else experiencing this problem: just restart Xcode and simulators and perform a Clean in the project. Worked for me.

Invalid pairing of layout attributes when specifying constraints programmatically in code in swift VC

I am following the pattern used in the the example here :
https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/blob/master/Lesson%2066/Lesson%2066/AppDelegate.swift
My VC (subclass of NSViewController) looks like this :
import Cocoa
class SecondViewController: NSViewController {
var leftView = ColorView()
var rightView = ColorView()
#IBOutlet weak var nameTextField: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
}
override func viewDidAppear() {
leftView.translatesAutoresizingMaskIntoConstraints = false
rightView.translatesAutoresizingMaskIntoConstraints = false
let leftConstraints:[NSLayoutConstraint] = [
leftView.widthAnchor.constraintEqualToAnchor(self.view.topAnchor),
leftView.leftAnchor.constraintEqualToAnchor(self.view.leftAnchor),
leftView.widthAnchor.constraintEqualToConstant(100),
leftView.heightAnchor.constraintEqualToConstant(100)
]
self.view.addSubview(leftView)
NSLayoutConstraint.activateConstraints(leftConstraints)
}
override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "SecondToFourthSegue" {
(segue.destinationController as! NSViewController).representedObject = nameTextField.stringValue
}
}
}
But I get the following error at runtime :
Invalid pairing of layout attributes
The full stack trace :
2016-04-26 00:54:06.402 Hyperterm[19046:1591173] An uncaught exception was raised
2016-04-26 00:54:06.403 Hyperterm[19046:1591173] *** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Invalid pairing of layout attributes
2016-04-26 00:54:06.403 Hyperterm[19046:1591173] (
0 CoreFoundation 0x00007fff89cf94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8b89b73c objc_exception_throw + 48
2 CoreFoundation 0x00007fff89d604bd +[NSException raise:format:] + 205
3 Foundation 0x00007fff8d717f92 VerifyConstraintArguments + 356
4 Foundation 0x00007fff8d717c16 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 295
5 Foundation 0x00007fff8d71d410 -[NSLayoutAnchor constraintEqualToAnchor:multiplier:constant:] + 149
6 Foundation 0x00007fff8d71e87f -[NSLayoutDimension constraintEqualToAnchor:multiplier:constant:] + 39
7 Hyperterm 0x000000010001bee1 _TFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 385
8 Hyperterm 0x000000010001c4b2 _TToFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 34
9 libdispatch.dylib 0x0000000100607070 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x00000001005f9cc5 _dispatch_client_callout + 8
11 libdispatch.dylib 0x00000001006116ae _dispatch_main_queue_callback_4CF + 2845
12 CoreFoundation 0x00007fff89cae9e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00007fff89c6d8dd __CFRunLoopRun + 1949
14 CoreFoundation 0x00007fff89c6ced8 CFRunLoopRunSpecific + 296
15 HIToolbox 0x00007fff949a7935 RunCurrentEventLoopInMode + 235
16 HIToolbox 0x00007fff949a776f ReceiveNextEventCommon + 432
17 HIToolbox 0x00007fff949a75af _BlockUntilNextEventMatchingListInModeWithFilter + 71
18 AppKit 0x00007fff878aeefa _DPSNextEvent + 1067
19 AppKit 0x00007fff878ae32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
20 AppKit 0x00007fff878a2e84 -[NSApplication run] + 682
21 AppKit 0x00007fff8786c46c NSApplicationMain + 1176
22 Hyperterm 0x000000010001b724 main + 84
23 libdyld.dylib 0x00007fff8fc285ad start + 1
24 ??? 0x0000000000000003 0x0 + 3
)
2016-04-26 00:54:06.405 Hyperterm[19046:1591173] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Invalid pairing of layout attributes'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff89cf94f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8b89b73c objc_exception_throw + 48
2 CoreFoundation 0x00007fff89d604bd +[NSException raise:format:] + 205
3 Foundation 0x00007fff8d717f92 VerifyConstraintArguments + 356
4 Foundation 0x00007fff8d717c16 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 295
5 Foundation 0x00007fff8d71d410 -[NSLayoutAnchor constraintEqualToAnchor:multiplier:constant:] + 149
6 Foundation 0x00007fff8d71e87f -[NSLayoutDimension constraintEqualToAnchor:multiplier:constant:] + 39
7 Hyperterm 0x000000010001bee1 _TFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 385
8 Hyperterm 0x000000010001c4b2 _TToFC9Hyperterm20SecondViewController13viewDidAppearfT_T_ + 34
9 libdispatch.dylib 0x0000000100607070 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x00000001005f9cc5 _dispatch_client_callout + 8
11 libdispatch.dylib 0x00000001006116ae _dispatch_main_queue_callback_4CF + 2845
12 CoreFoundation 0x00007fff89cae9e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00007fff89c6d8dd __CFRunLoopRun + 1949
14 CoreFoundation 0x00007fff89c6ced8 CFRunLoopRunSpecific + 296
15 HIToolbox 0x00007fff949a7935 RunCurrentEventLoopInMode + 235
16 HIToolbox 0x00007fff949a776f ReceiveNextEventCommon + 432
17 HIToolbox 0x00007fff949a75af _BlockUntilNextEventMatchingListInModeWithFilter + 71
18 AppKit 0x00007fff878aeefa _DPSNextEvent + 1067
19 AppKit 0x00007fff878ae32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
20 AppKit 0x00007fff878a2e84 -[NSApplication run] + 682
21 AppKit 0x00007fff8786c46c NSApplicationMain + 1176
22 Hyperterm 0x000000010001b724 main + 84
23 libdyld.dylib 0x00007fff8fc285ad start + 1
24 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
leftView.widthAnchor should not equal to self.view.topAnchor You might not pay attention to it

Swift - Editing UITextView from inside callback crashes app

I have the following code that makes a HTTP Request, then outputs the result to a UITextView:
#IBOutlet var echoLog: UITextView!
#IBAction func sendEcho(sender: AnyObject) {
let callback = { (textString: String) -> Void in
self.echoLog.text = textString // App crashes here :(
}
HTTPRequest("http://localhost/echo", ["echo": "Echo!"], callback)
}
But when I call sendEcho the app crashes with this error:
2014-07-28 20:58:22.218 AppName[10463:144343] *** Assertion failure in void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView<NSTextContainerView> *, NSTextContainer *, NSUInteger)(), /SourceCache/UIFoundation_Sim/UIFoundation-364/UIFoundation/TextSystem/NSLayoutManager_Private.m:1547
2014-07-28 20:58:22.231 AppName[10463:144343] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only run on the main thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00496ca6 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01df08bf objc_exception_throw + 44
2 CoreFoundation 0x00496b3a +[NSException raise:format:arguments:] + 138
3 Foundation 0x00904d2e -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 102
4 UIFoundation 0x03344072 -[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] + 418
5 UIFoundation 0x03343d6e -[NSLayoutManager(NSPrivate) _recalculateUsageForTextContainerAtIndex:] + 2017
6 UIFoundation 0x0337da43 -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 871
7 UIFoundation 0x0337db53 -[NSLayoutManager processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:] + 85
8 UIFoundation 0x033a7a7b -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 153
9 UIFoundation 0x033a759a -[NSTextStorage processEditing] + 458
10 UIFoundation 0x033a7124 -[NSTextStorage endEditing] + 80
11 UIFoundation 0x033a71af -[NSTextStorage coordinateEditing:] + 67
12 UIKit 0x014938ae -[UITextView setAttributedText:] + 250
13 UIKit 0x01499745 -[UITextView setText:] + 149
14 AppName 0x00036216 _TFFC8AppName19FirstViewController8sendEchoFS0_FPSs9AnyObject_T_U_FOS_9JSONValueT_ + 1350
15 AppName 0x0003525a _TPA__TFFC8AppName19FirstViewController8sendEchoFS0_FPSs9AnyObject_T_U_FOS_9JSONValueT_ + 106
16 AppName 0x0001de86 _TFF8AppName11HTTPRequestFTSSGVSs10DictionarySSPSs9AnyObject__FOS_9JSONValueT__T_U_FTGSQCSo6NSData_GSQCSo13NSURLResponse_GSQCSo7NSError__T_ + 1350
17 AppName 0x0001d0a4 _TPA__TFF8AppName11HTTPRequestFTSSGVSs10DictionarySSPSs9AnyObject__FOS_9JSONValueT__T_U_FTGSQCSo6NSData_GSQCSo13NSURLResponse_GSQCSo7NSError__T_ + 100
18 AppName 0x0001e289 _TTRXFo_oGSQCSo6NSData_oGSQCSo13NSURLResponse_oGSQCSo7NSError__dT__XFo_iTGSQS__GSQS0__GSQS1____iT__ + 41
19 AppName 0x0001d15a _TPA__TTRXFo_oGSQCSo6NSData_oGSQCSo13NSURLResponse_oGSQCSo7NSError__dT__XFo_iTGSQS__GSQS0__GSQS1____iT__ + 90
20 AppName 0x0001e2d7 _TTRXFo_iTGSQCSo6NSData_GSQCSo13NSURLResponse_GSQCSo7NSError___iT__XFo_oGSQS__oGSQS0__oGSQS1___dT__ + 55
21 AppName 0x0001d224 _TPA__TTRXFo_iTGSQCSo6NSData_GSQCSo13NSURLResponse_GSQCSo7NSError___iT__XFo_oGSQS__oGSQS0__oGSQS1___dT__ + 100
22 AppName 0x0001e36e _TTRXFo_oGSQCSo6NSData_oGSQCSo13NSURLResponse_oGSQCSo7NSError__dT__XFdCb_dGSQS__dGSQS0__dGSQS1___dT__ + 142
23 CFNetwork 0x02c36158 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 181
24 Foundation 0x0092da35 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
25 Foundation 0x00854635 -[NSBlockOperation main] + 99
26 Foundation 0x00833a97 -[__NSOperationInternal _start:] + 700
27 Foundation 0x008337c9 -[NSOperation start] + 83
28 Foundation 0x00833613 __NSOQSchedule_f + 237
29 libdispatch.dylib 0x022ef3ff _dispatch_client_callout + 14
30 libdispatch.dylib 0x022d8578 _dispatch_queue_drain + 1424
31 libdispatch.dylib 0x022d7f90 _dispatch_queue_invoke + 142
32 libdispatch.dylib 0x022d9e06 _dispatch_root_queue_drain + 312
33 libdispatch.dylib 0x022dae67 _dispatch_worker_thread2 + 45
34 libsystem_pthread.dylib 0x0263fdab _pthread_wqthread + 336
35 libsystem_pthread.dylib 0x02643cce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Thanks in advance!
It looks like your problem is that you are not on the mainThread, by the second line in the trace.
You are probably still running code in the background, due to the nature of HTTPRequest asynchronous handling of data... that's fine. You just need to get to the main thread, after all is said and done.
Here's how to probably fix it...
#IBAction func sendEcho(sender: AnyObject)
{
let callback = {(textString: String) in
dispatch_sync(dispatch_get_main_queue())
{
self.echoLog.text = textString //Yay!
}
}
HTTPRequest("http://localhost/echo", ["echo": "Echo!"], callback)
}
Reminder time UI updates should only be performed on the mainThread. Simply because doing so provides high priority for this thing to occur. Usually when you try to do UI updates on a background thread, you will see a delay between when the code is executed and when you see results. In this case, an Assertion failure (I like that). If you do not know if you are on the main thread, you can check it out by doing NSThread.isMainThread() which returns a bool.
Warning If you are already on the main thread while calling dispatch_sync(dispatch_get_main_queue()) {...} your app will freeze up, so make sure you know what thread you are on...
Apple will only let you modify UI components on the main event loop. It appears that the HTTPRequest is running callback on a background thread so you will have to explicitly run the change on the main thread:
let callback = { (textString: String) -> Void in
dispatch_async(dispatch_get_main_queue(), {
self.echoLog.text = textString
})
}

application crashes -= XMPP for iPhone

I am creating chat application and I am using the XMPP code ,
Here is the application logs shows the crash , please help me out if any one knows the solutions
Terminating app due to uncaught exception
'NSInvalidArgumentException',
reason: '-[XMPPvCardCoreDataStorage clearvCardTempForJID:xmppStream:]: unrecognized selector sent to instance 0x29bbe0'
Here is the Stack
Call stack at first throw:
(
0 CoreFoundation 0x3172464f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3523fc5d objc_exception_throw + 24
2 CoreFoundation 0x317281bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x317278ad -[NSObject(NSObject) forwardInvocation:] + 36
4 CoreFoundation 0x3172768d ___forwarding___ + 576
5 CoreFoundation 0x3169e180 _CF_forwarding_prep_0 + 48
6 iPhoneXMPP 0x0003681d -[XMPPvCardAvatarModule xmppStreamWillConnect:] + 132
7 CoreFoundation 0x317277a4 __invoking___ + 68
8 CoreFoundation 0x3169f43d -[NSInvocation invoke] + 108
9 CoreFoundation 0x3169f0d9 -[NSInvocation invokeWithTarget:] + 36
10 iPhoneXMPP 0x0002a383 __42-[GCDMulticastDelegate forwardInvocation:]_block_invoke_0 + 70
11 libdispatch.dylib 0x3600a8e7 _dispatch_call_block_and_release + 10
12 libdispatch.dylib 0x36005ec1 _dispatch_queue_drain + 240
13 libdispatch.dylib 0x36006033 _dispatch_queue_invoke + 78
14 libdispatch.dylib 0x360055f1 _dispatch_worker_thread2 + 192
15 libsystem_c.dylib 0x3640b591 _pthread_wqthread + 264
16 libsystem_c.dylib 0x3640bbc4 _init_cpu_capabilities + 4294967295
)
Thanks in advance
I think you are calling the following method,
- (void)clearvCardTempForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream
it should be called with two arguments ie JabberId and XmppStream object.You may set those thing wrongly.
[XMPPvCardCoreDataStorage clearvCardTempForJID:urNeededJid:xmppStream];