tags:

views:

50

answers:

2

hi all, i have a stupid question...sometimes i see developers use the following code...

NSString *newURL = [_parameters objectForKey:@"url"];

when i use this i get error... here what is _parameters and how to declare it??

i can provide more example..

        NSLog(@"SaveImage Called");
        //google code for turning base64 into uiimage
   NSURL *url = [NSURL URLWithString:[self._parameters objectForKey:@"imageData"]];    
   NSData *imageData = [NSData dataWithContentsOfURL:url];
   UIImage *img = [UIImage imageWithData:imageData];   
   /*
   if(img != nil) {
      UIImageWriteToSavedPhotosAlbum(img, self, nil, nil);
   }
   */   
+1  A: 

_parameters is a NSDictionary that seems to be defined previously in the code, e.g.

NSDictionary _parameters = [NSDictionary dictionaryWithObjects:@"foo", @"bar", nil
                                         forKeys:@"url", @"host", nil];

What exactly is your question? How is this related to JavaScript (edit: question was tagged as javascript)? You know that the language you use is Objective-C ?

Felix Kling
A: 

yes...thats my fault...sure it is objective c and i am dealing with it....thanks Kling for ur replay....please look at the code NKRegisterClass("Common");

    ///javascript call objective c with parameter
      function SaveImage()
      {
         CallNKitAction("SaveImage?className=Common&imageData="+base64+"&sync=yes");            
      }

///////objective c method

- (void)SaveImage
{   
        NSLog(@"SaveImage Called");
        //google code for turning base64 into uiimage
   NSURL *url = [NSURL URLWithString:[self._parameters objectForKey:@"imageData"]];    
   NSData *imageData = [NSData dataWithContentsOfURL:url];
   UIImage *img = [UIImage imageWithData:imageData];   
   /*
   if(img != nil) {
      UIImageWriteToSavedPhotosAlbum(img, self, nil, nil);
   }
   */   
}

can u please tell how _parameters get objects when the function is called from javascript??i am totally confused...

Rony
What's up with the JavaScript?
Douwe Maan
sorry....i can't understand ur quesiton
Rony
You should not post this as an answer but edit your question. It seems `_parameters` is a property of the class so check the header and implementation file for `_parameters`.
Felix Kling
i don't have the project....so i ask here....
Rony
@Rony: Well, I don't know the `NKRegisterClass` or `Common` class so I don't know how to help you.
Felix Kling
@Kling:Thanks....i am actually dealing with NimbleKit..
Rony