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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:23:54+00:00 2026-05-27T12:23:54+00:00

I have my own object class from inherited from NSObject @interface BlockedCell : NSObject

  • 0

I have my own object class from inherited from NSObject

@interface BlockedCell : NSObject 
{
    NSValue *gridValue;
    NSString *name;
}

@property (nonatomic, retain) NSValue *gridValue;
@property (nonatomic, retain) NSString *name;

@end

So I try to create a few objects:

NSMutableDictionary *dict = [[dict alloc] init];
for (int i = 0; i < 5; ++i)
{
    BlockedCell *block = [[BlockedCell alloc] init];
    block.gridValue = [NSValue valueWithCGPoint: CGPointMake(0.0f, 0.0f)];
    block.name = @"something";
    [dict setObject: block forKey: [NSString stringWithFormat: @"item_%d", i]];
    [block release];
}

if([dict writeToFile: path atomic: YES])
   NSLog(@"Saved");
else
   NSLog(@"Failed to save");

[dict release];

And what I get for the output is “Failed to save”..
If my dictionary does not contains any data, then it will output “Saved”

EDIT:
After I did more testing, I found out that actually is the NSValue causing the saving failed.
So what should I do if I want to save CGPoint into plist?

  • 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-27T12:23:55+00:00Added an answer on May 27, 2026 at 12:23 pm

    As you discovered, property lists cannot store NSValue objects directly. The supported classes are NSData, NSString, NSArray, NSDictionary, NSDate, and NSNumber, as documented in the NSPropertyListSerialization Class Reference.

    The easiest workaround would be to use NSString instead of NSValue:

    block.gridString = NSStringFromCGPoint(CGPointZero);
    
    CGPoint point = CGPointFromString(block.gridString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented my own class that inherits from the SettingsProvider class. If the
I have my own php data object class that wraps the mysqli library. It
I have a class A that is inherited from B. A as some readonly
I have an own Tree object implemented in PHP. Say we have a tree
I have a Winforms application that generates its own PrintDocument object for printing. It
I'm creating my own JavaScript Array-like object and I have methods that call closures.
I have an application where for each object the user can specify his own
I'm trying to hide window after its startup. I have own window-class which is
How would one return a class computed CSS property/property array? Like, if I have
If I have a complex object, can I inherit from it and remove or

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.