私はObjectiveCを初めて使用するので、無知を許してください。私はこのコードを機能させようとしていますが、役に立ちません。
ヘッダーファイルで、プロパティを宣言しました。
@interface UIWebViewScriptDebugDelegate : NSObject
@property (nonatomic, strong) NSMutableDictionary *sourceIDMap;
@end
私のコードファイルでは、それを合成して初期化します。
@implementation UIWebViewScriptDebugDelegate
@synthesize sourceIDMap = sourceIDMap_;
- (id)init
{
if ((self = [super init])) {
self.sourceIDMap = [[NSMutableDictionary alloc] init];
}
return self;
}
それは問題なく機能します。NSLog
呼び出しを挿入すると、それself.sourceIDMap
は確かに辞書であることがわかります。ただし、別のメソッドがプロパティにアクセスしようとした瞬間に、NSMutableDictionary
なくなったように見えます。
- (void) webView:(WebView*)webView
didParseSource:(NSString*)source
baseLineNumber:(unsigned int)baseLineNumber
fromURL:(NSURL*)url
sourceId:(int)sourceID
forWebFrame:(WebFrame*)webFrame
{
// ...
NSLog(@"Look what we got here:");
NSLog(@"%@", self.sourceIDMap);
}
時々それはDOMCSSStyleDeclaration
、時々それはDOMHTMLHeadElement
:です
360 MyApp[49113:1507] Look what we got here:
360 MyApp[49113:1507] <WebScriptObjectPrivate: 0x14540d20>
361 MyApp[49113:1507] -[DOMCSSStyleDeclaration sourceIDMap]: unrecognized selector sent to instance 0xc32e550
361 MyApp[49113:1507] *** WebKit discarded an uncaught exception in the webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame: delegate: <NSInvalidArgumentException> -[DOMCSSStyleDeclaration sourceIDMap]: unrecognized selector sent to instance 0xc32e550
367 MyApp[49113:1507] Look what we got here:
368 MyApp[49113:1507] <WebScriptObjectPrivate: 0x14540ee0>
369 MyApp[49113:1507] -[DOMHTMLHeadElement sourceIDMap]: unrecognized selector sent to instance 0x145ec820
369 MyApp[49113:1507] *** WebKit discarded an uncaught exception in the webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame: delegate: <NSInvalidArgumentException> -[DOMHTMLHeadElement sourceIDMap]: unrecognized selector sent to instance 0x145ec820
どこにありNSMutableDictionary
ますか?保持されるはずではないですか?
アップデート
これが役立つ場合は、MonoTouchから呼び出しているARCが有効になっている静的ライブラリにコードがコンパイルされます。