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 7929063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:56:58+00:00 2026-06-03T19:56:58+00:00

So the short of it is I want to define a global string variable

  • 0

So the short of it is I want to define a global string variable that I can reference whenever. The function that I reference it in, it returns a string. As soon as I store it and reference it in another function it outputs as <CGPath 0x5bbf50>

What the heck? The code is below and keep in mind this is a module for Titanium.
First, the definition of the global variable..

@interface ComTestModule : TiModule <CBCentralManagerDelegate, CBPeripheralDelegate>
{
    NSString * teststring;
}

The next part is the function where I first send the string variable from titanium to xcode..

-(void)setService:(id)args{
    ENSURE_ARG_COUNT(args, 2);
    teststring = [args objectAtIndex:0];
    NSLog(teststring);
}

The output of the NSLog displays the actual string that was passed.
Now the final function where I call the string again and attempt to output it to the log..

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error
{
        NSLog(@"---%@", teststring);
}

As I said before, during this step it outputs as ---<CGPath 0x3ef4e0>

I’m really not sure what’s going on.. Any help at all about getting this to return as the original string instead of the CGPath would be great!

  • 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-03T19:56:59+00:00Added an answer on June 3, 2026 at 7:56 pm

    Effects like this typically happen when you store a pointer to an object that was released and deallocated. The runtime will then replace that chunk of memory that previously held an NSString instance with, in this particular case, a CGPath instance.

    If you want to ensure that your NSString stays alive, you need to take ownership of it. You can do that by either retaining it or copying it. Copying is the preferred method when talking about strings, so try replacing this line:

    teststring = [args objectAtIndex:0];
    

    With this:

    teststring = [[args objectAtIndex:0] copy];
    

    Now just be sure to release it when you’re done.

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

Sidebar

Related Questions

In C++ I wanted to define a constant that I can use in another
In short: I want to have two fullscreen views, where I can switch between
I want to store short arrays in a field. (I realize there are reasons
I want to test whether a certain string is contained in a short list
In short: is there some way I can modify a class definition such that
What solution is better and recommended for short string elements? To define block and
PartialFunctions In Scala, a PartialFunction is, in short, a function that additionally defines an
In short: How do I define operator= for my class such that it compiles
How can I tell closure compiler that an anonymous function should not be removed
SHORT DESCRIPTION OF PROBLEM: I want to set the text of a searchbar without

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.