1

I have a property in my CustomClass1: @property(assign)NSString *url;

- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id < WebPolicyDecisionListener >)listener{
_url= [[request URL] absoluteString] ;
NSLog(@"requested url is %@",_url);
NSInteger index=[_tabView numberOfTabViewItems];
NSTabViewItem *newItem=[[NSTabViewItem alloc] init];
[_tabView insertTabViewItem:newItem atIndex:index];
[newItem setLabel:@"Empty Tab" ];
//[_tabView  selectPreviousTabViewItem:@"select"];
[self initializeWebView:newItem];
[[_tabView .tabViewItems objectAtIndex:index] setView:[newVC view]];
 // NSLog(@"requested url is %@",url);

}

-(void)awakeFromNib{

CustomClass1 *obj=[[CustomClass1 alloc] init];
NSLog(@"url is %@",[obj url]);
[[_newWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:obj.url]]];

}

how can i get the value of _url in my awakefromnib method in Viewcontroller class? NSlog is returning null. how can i resolve this issue? Please help me out

user1295948
  • 303
  • 1
  • 5
  • 15

1 Answers1

0

Your "url" property needs to be allocated and initialized to something before it can return something other than "nil".

You could set your "url" property's contents in the "init" method of your "CustomClass1" object, but there's a bit of a trick to doing this (see this related StackOverflow question).

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215