Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8938051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:32:09+00:00 2026-06-15T10:32:09+00:00

Trying to create a connection of a request with an URL. An NSMutableData instance

  • 0

Trying to create a connection of a request with an URL. An NSMutableData instance (responseData) also gets called with it. When the connection starts receiving response, the setLength:NSUInteger method gets called up on the NSMutableData Instance.

-(void)startDataDownloading
{
    NSURLRequest *_request = [NSURLRequest requestWithURL:self.url];
    if (_request) {
        if (!connecton) {
            connecton = [NSURLConnection connectionWithRequest:_request delegate:self];
            if (connecton) {
                responseData = [NSMutableData data];
                [connecton start];
            }
        }
    }
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [responseData setLength:0];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [responseData appendData:data];
}

But somehow it causes a crash with a warning on the setLength call. The error states that

” -[__NSCFDictionary setLength:]: unrecognized selector sent to instance 0x6a8cf70
2012-11-30 18:00:38.948 RSSReader[8997:f803] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSCFDictionary setLength:]: unrecognized selector sent to instance 0x6a8cf70’ ”

Any hint about this would be appreciated.

#import <Foundation/Foundation.h>
#import "DataParser.h"

@protocol DataConnectionDelegate <NSObject>
//protocol methods
@end
@interface UCDataConnection : NSObject <ModelParser>
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) NSURLConnection *connecton;
@property (strong, nonatomic) NSMutableData *responseData;
@property (nonatomic, assign) id<DataConnectionDelegate> delegate;
-(void)startDataDownloading;
- (id)initWithUrl:(NSURL *)_url andDelegate:(id<DataConnectionDelegate>)_delegate;

That is a part of the header file.Sorry for late response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:32:11+00:00Added an answer on June 15, 2026 at 10:32 am

    Most likely you’re not retaining responseData correctly, so it’s being released and in your above example you happen to end up getting an NSDictionary allocated in the same place.

    If you’re using ARC then the code you posted is fine (other than that “responseData” should probably have an underscore prefix, assuming it’s an instance variable).

    If you’re using retain-release, then you need to add a call to retain when you allocate responseData.

    Update: Based on your header file it looks like you’re referring to the instance variable directly, and using retain-release. Your best option is to refer to responseData only through the property mechanism – i.e. prefix all its uses with self..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a soap connection to Magento's web services, however I'm getting
I'm trying to dynamically create a connection string during compile time: private static string
I am trying to create a database of users with connection between users (friends
I am currently trying to get my server to create a connection with a
Two part question Part one: I am trying to create an ASynchronous request to
I am trying to send a request to an url like this http://mysite.dk/tværs?test=æ from
I am trying to create a friendship and I created a custom action called
So I am trying to create a request that will automatically follow the redirects
I am trying to enable BOSH connection over Openfire so that i can create
I'm trying to create a reusable component to display some photo collection. The basic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.