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

    Joined:
    Mar 27, 2009
    #1
    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:

    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

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #2
    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

    Joined:
    Mar 6, 2014

Share This Page