2 つのアプリを 1 つに統合しています。最初のアプリはチャットアプリです。Gmail アカウントから Gmail チャット仲間を取得するために xmpp フレームワークを使用しました。他のアプリでは、Google Data Protocol を使用して gmail アカウントにログインし、すべての連絡先を取得しました。これらの両方のプロジェクトを統合すると、奇妙な問題が発生しました。
Google Data Protocol と XMPP の両方が nsxml オブジェクトを定義します。
例: XMPP では、nsxml 要素は次のように定義されます。
#ifndef NSXMLElement
#define NSXMLElement DDXMLElement
#endif
#ifndef NSXMLDocument
#define NSXMLDocument DDXMLDocument
#endif
Google Data Protocol では、nsxml 要素は次のように定義されています。
#define NSXMLDocument GDataXMLDocument
#define NSXMLElement GDataXMLElement
私の問題は、両方のプロトコルが nsxml オブジェクトを定義していることです。そのため、次のようなチャット メッセージを送信しようとするとエラーが発生します。
-[GDataXMLElement addAttributeWithName:stringValue:]: unrecognized selector sent to instance 0x8101450
2010-12-14 19:12:32.430 GMIProject[1870:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GDataXMLElement addAttributeWithName:stringValue:]: unrecognized selector sent to instance 0x8101450'
*** Call stack at first throw:
(
0 CoreFoundation 0x029c1b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x034b440e objc_exception_throw + 47
2 CoreFoundation 0x029c36ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x029332b6 ___forwarding___ + 966
4 CoreFoundation 0x02932e72 _CF_forwarding_prep_0 + 50
5 GMIProject 0x000057f2 -[ChatViewController send:] + 410
6 UIKit 0x0048a7f8 -[UIApplication sendAction:to:from:forEvent:] + 119
7 UIKit 0x0069668b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
8 UIKit 0x0048a7f8 -[UIApplication sendAction:to:from:forEvent:] + 119
9 UIKit 0x00515de0 -[UIControl sendAction:to:forEvent:] + 67
10 UIKit 0x00518262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
11 UIKit 0x00516e0f -[UIControl touchesEnded:withEvent:] + 458
12 UIKit 0x004ae3d0 -[UIWindow _sendTouchesForEvent:] + 567
13 UIKit 0x0048fcb4 -[UIApplication sendEvent:] + 447
14 UIKit 0x004949bf _UIApplicationHandleEvent + 7672
15 GraphicsServices 0x03871822 PurpleEventCallback + 1550
16 CoreFoundation 0x029a2ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
17 CoreFoundation 0x02903807 __CFRunLoopDoSource1 + 215
18 CoreFoundation 0x02900a93 __CFRunLoopRun + 979
19 CoreFoundation 0x02900350 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x02900271 CFRunLoopRunInMode + 97
21 GraphicsServices 0x0387000c GSEventRunModal + 217
22 GraphicsServices 0x038700d1 GSEventRun + 115
23 UIKit 0x00498af2 UIApplicationMain + 1160
24 GMIProject 0x00002422 main + 84
25 GMIProject 0x000023c5 start + 53
ここで私のチャット アプリケーションは xmpp フレームワークの関数を呼び出しますが、NSXml オブジェクトが GData オブジェクトによって再定義および上書きされているため、GData の関数が呼び出され、例外が発生します。