0

Situation. XMLProxy Class is singleton. XMLRequest Class too.

Normally, when I want to request URL. Example :

XMLProxy *xmlProxy = [XMLProxy sharedInstance];
[xmlProxy tryGetDataWithParameter:example_parameter];

// Method "tryGetDataWithParameter" will call method "requestURL" from XMLRequest Class

// Assume that is [xmlRequest requestURL];

// and XMLProxy Class (XMLProxy delegate) will create xml parser for each "example_parameter" 
type to response xml data receive.

It's no problem.

Question? I want to create visual background process to request URL and I create AutoSending Class that is singleton.

I want to use AutoSending Class to call method "tryGetDataWithParameter" (from XMLProxy class). Example to call : [autoSending start];

-(void)start{ XMLProxy *xmlProxy = [XMLProxy sharedInstance]; [xmlProxy tryetDataWithParameter:example_parameter]; }

Can I use NSThread to call statement "[autoSending start]"; It is the result of a visual Background Process.

ronalchn
  • 12,225
  • 10
  • 51
  • 61
ZhOCKeR
  • 3
  • 2

1 Answers1

1

Rather than try to code all this up by yourself, why not use a library like AFNetworking which is built on top of NSURLConnection, NSOperation, and other standard IOS technologies. You can then use NSOperationQueue to run your request on another thread.

Bryan
  • 11,398
  • 3
  • 53
  • 78