Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a DDXMLElement containing an NSArray #47

Open
alessioarsuffi opened this issue Jan 8, 2016 · 2 comments
Open

Create a DDXMLElement containing an NSArray #47

alessioarsuffi opened this issue Jan 8, 2016 · 2 comments

Comments

@alessioarsuffi
Copy link

Hi everybody,

i'm trying to create a DDXMLElement which contains an nsarray of NSInteger, my code is:

DDXMLElement *type = [DDXMLElement elementWithName:@"type" stringValue:@"news_user_update_categories_subscriptions"];

DDXMLElement *channelId = [DDXMLElement elementWithName:@"news_channel_id" numberValue: [NSNumber numberWithInteger: _newsChannelId]];

DDXMLElement *subscriptionList = [DDXMLElement elementWithName:@"updated_categories_subscriptions_list" children:nil attributes: _categoriesSubscriptions];

when subscriptionList is going to be created, compiler return this error to me:

'NSInvalidArgumentException', reason: '-[__NSCFNumber _hasParent]: unrecognized selector sent to instance, 

i searched on internet but no results found, any help?

@zadr
Copy link

zadr commented Jan 8, 2016

The pasted code by itself looks okay, but it also references other instance variables that aren't shown. We can't really guess at whats happening here and come up with a helpful answer.

Try setting an Objective-C exception breakpoint in Xcode, and re-running your code instead?

@alessioarsuffi
Copy link
Author

thanks for your answer, debugging through the code showed that the crash is thrown on this line:

DDXMLAssert([attribute _hasParent] == NO, @"Cannot add an attribute with a parent; detach or copy first");

in the class DDXMLElement.m,

searched in internet gave me this results:

http://stackoverflow.com/questions/6048072/xml-element-inserting-error-with-objective-c-garbage-collection-turned-on,

however i'm still facing crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants