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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:43:03+00:00 2026-05-22T21:43:03+00:00

I am trying to write a bit of Objective-C (which is new for me,

  • 0

I am trying to write a bit of Objective-C (which is new for me, my background is more C++), and wanted to create a CFString like this :

CFString myString;

When I try to build my project the following error :

"'CFString' undeclared" (first use in this function)

prevents from building.
I thought I had just forgot to include the relevant header, but I cannot find which one to include. When I look into some sample code I never see “CFString” but rather “CFStringRef” objects, defined as

A reference to a CFString object.
typedef const struct __CFString *CFStringRef;

I started to suspect there is no such thing as a CFString that i can refer to in the code, but I feel I am wrong somewhere. Am I ?
Is it impossible to create CFStrings ? Is it specific to CFString or to all the structs in objective-c ?

  • 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-05-22T21:43:04+00:00Added an answer on May 22, 2026 at 9:43 pm

    CFStringRef is part of the Core Foundation library which is not ObjC but plain C. Core Foundation uses a runtime to create instances, this runtime will call callbacks to initialize the structs content and manages the instances memory.
    This is why there is no CFString because you shouldn’t create static instances on the stack but rather call the appropriate create function which will then ask the runtime for a new instance with everything already initialized for you. For CFStringRef this would be CFStringCreate(), see also: http://developer.apple.com/library/ios/#documentation/CoreFoundation/Conceptual/CFStrings/introCFStrings.html

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

Sidebar

Related Questions

I am new to php and trying to write a login function. Bit stuck
I'm trying to write a bit of jquery which finds all h2 tags inside
I am trying to write a function in C++ which takes two 64 bit
Guys I'm a bit new in using java and i'm trying to write a
I'm trying to write a bit of code which sends a single int over
I'm trying to write a bit rotator function and I'm trying to get more
I am trying to write a bit of code to take a string (this
I'm a bit new to python, but familiar with OOP. I'm trying to write
I am trying to write unit tests for a bit of code involving Events.
I'm trying to write bytes using the write() Unix system call, but any 8-bit

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.