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

  • Home
  • SEARCH
  • 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 9000911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:22:09+00:00 2026-06-16T00:22:09+00:00

I have this code: -(void)getData:(NSString *)data: (id) tv: (id) soc { NSLog(@\nin get data

  • 0

I have this code:

-(void)getData:(NSString *)data: (id) tv: (id) soc
{
NSLog(@"\nin get data with data\n");
NSLog(data);

After a few hours the app crashes and it reaches in get data with data and doesn’t print the data so it’s crashing on the print of the data. The debug references the failure in something like a string length function. In XCode, data has a warning that it is not a string literal and potentially insecure. Now my experience tells me the most likely culprit is data is somehow null. But it also printed in the log something that looks like it received a typical message. it said it has 131 bytes from the socket. When i tested and it crashed last time it has 189 bytes. but it never prints it.

The data is sent in from the socket liket this in receive data:

UInt8 buffer[len];
NSLog(@"Received %d bytes from socket %d\n", 
      len, CFSocketGetNative(s));
CFDataGetBytes(df, range, buffer);
NSString *oldtext = [mTextViewAlias text];

char buffer2[len];
for(int a=0; a<len; a++)
   buffer2[a]=buffer[a];

NSMutableData *buffer3 = [[NSMutableData alloc] init];
[buffer3 appendBytes:buffer2 length:len];
NSString *newdata = [[NSString alloc] initWithData: buffer3 encoding:NSASCIIStringEncoding];    

and the call to the class method that is crashing when it prints the data is just:

[mytelnet getData:newdata:mTextViewAlias:(__bridge id)(s)];

Could i have a memory leak or something and after a few hours i’m out of memory causing the assignment of new data to be null even if i start out with some 100 bytes? Would it crash only when i tried to print data in the nslog and not earlier if it failed to allocate memory?

Mike

  • 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-16T00:22:09+00:00Added an answer on June 16, 2026 at 12:22 am

    Instead of

    NSLog(data);
    

    use

    NSLog(@"%@",data);
    

    That may not solve your root cause but you get rid of the warning and may get some more reasonalbe and helpful debug output.

    You might get rid of that crash too. Hovever this is not a promise.

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

Sidebar

Related Questions

I have used this code to load data from a plist. -(void)loadOrCreateData { NSLog(@Start
Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
I have some legacy code that looks like this: void* getData(DataType dataType) { switch(dataType)
I am using this code to fetch the core data results: -(void)getData { NSEntityDescription
I have this code : void Main() { System.Timers.Timer t = new System.Timers.Timer (1000);
I have this JSON response string: {d:{\ID_usuario\:\000130\,\Nombre\:null,\Vipxlo\:0,\Provmun\:null,\Descuentos\:null,\Listaviplocal\:null}}` With this code: - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
I have this code: private void timer1_Tick(object sender, EventArgs e) { #region BaseAddress Process[]
I have this code private void writeReport(IReport report, string reportName) { string reportString =
I have this code: @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { GLES20.glClearColor(0, 0,
I have this segment of code: - (void)setTableView:(UITableView *)tableView { tableView = tableView; }

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.