How do I stream a video that is being played in Safari to an Apple TV?

Discussion in 'iOS Programming' started by moonman239, Apr 11, 2014.

  1. moonman239 macrumors 68000

    Mar 27, 2009
    Hi, I want to use the NSXMLParser class to parse through XML data. To help me, I created a TreeNode class that contains information about each node's parent node, child nodes, name and attribute values.

    I came up with a solution, but my concern is that any app that uses the code will take a little too much RAM.

    Here's my code:

    NSMutableArray *unendedElements;
    -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
            // This element is a child of the node that is represented by currentTreeNode.
            TreeNode *newTreeNode = [[TreeNode alloc] initWithName:elementName];
            [unendedElements addObject:newTreeNode];
        NSInteger unendedElementCount = [unendedElements count];
        if (unendedElementCount > 1) {
            TreeNode *parentNode = [unendedElements objectAtIndex:(unendedElementCount - 2)];
            [parentNode addChildNode:newTreeNode];
    -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
        [unendedElements removeLastObject];
    How can I make it better?
  2. waterskier2007 macrumors 68000


    Jun 19, 2007
    Novi, MI
    What's up with the title of this post?

    As for the RAM usage, profile the app and check the usage in Instruments
  3. JohnsonK macrumors regular

    Mar 6, 2014

Share This Page