Forums: 

About line 234 of GnViewController has the method 'downloadLatestBundle'. This method appears to read the local bundle file (1557.b) from disk and feed it to the local stream ingest object.

Suggest reviewing this method name as it is misleading as no downloading actually occurs.

Furthermore, the first comment in the method seems inaccurate:

- (void)downloadLatestBundle

{
    NSError *    error = nil;

    //    Look for the 10,000 track bundle and if not found try the little one.
    NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"1557.b" ofType: nil];
   
    if (bundlePath) {
        [self.gnLookupLocalStream storageClear:&error];
        
        if (!error) {
            __block GnLookupLocalStreamIngest *lookupLocalStreamIngest = [[GnLookupLocalStreamIngest alloc] initWithGnLookupLocalStreamIngestEventsDelegate:self];
            
            // Load Bundle in a separate thread to keep the UI responsive. This is required for Large Bundles that can take few minutes to be ingested.
            
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                
                NSError *error = nil;
                NSInteger bytesRead = 0;
                double totalBytesRead = 0;
                uint8_t buffer[1024];
                NSInputStream *fileInputStream = [NSInputStream inputStreamWithFileAtPath:bundlePath];
                
                [fileInputStream open];
                
                do {
                    bytesRead =  [fileInputStream read:buffer maxLength:1024];
                    [lookupLocalStreamIngest write:buffer dataSize:sizeof(buffer) error:&error];
                    
                    if(error)
                    {
                        NSLog(@"Error during lookupLocalStreamIngest write: %@", [error localizedDescription]);
                    }
                    
                    totalBytesRead+=bytesRead;
                    
                } while (bytesRead>0);
                
                [lookupLocalStreamIngest flush:&error];
                [fileInputStream close];
            });
        }
    }
}

 

Forum Discussions