title: RACSignal: RACSignal code is not executed
body: <p>Is there a willing soul who could kindly help me with this problem?</p>
  
  <p><strong>This is my scenario:</strong></p>
  
  <p>I need to upload form attachments to the server. So here are the steps:</p>
  
  <ol>
  <li><p>Retrieve attachment headers from server using Web service.</p></li>
  <li><p>Match the attachment header with local attachments.</p></li>
  <li><p>Upload attachments to server.</p></li>
  </ol>
  
  <p><strong>The Problem:</strong></p>
  
  <p>Using RACSignal I can successfully obtain the attachment headers but when it's time to upload the attachments using NSArray the inner RACSignal of the UploadFormItemAttachments method will not execute.</p>
  
  <p><strong>Additional Information:</strong></p>
  
  <p>This is the code snippet that shows how the RACSignals are handled. BatchSignal is never executed!:</p>
  
  <pre><code>[[[self getFormItemAttachmentHeaders:listName
                            topListItemID:form.topListItemID
                                    form:form
       ] map:^id(NSMutableArray* value) {
          NSArray* attachmentHeaders = [value copy];
  
          // the code of uploadFormItemAttachments is called but the inner signal does not execute. Why?
          return [self uploadFormItemAttachments:pendingAttachments
                                          attachmentHeaders:attachmentHeaders
                                                       form:form];
          }
        ] subscribeNext:^(id value) {
            // I was expecting the completion result form uploadFormItemAttachments here.
          }
       ];
  </code></pre>
  
  <p>This the method that iterates over the attachments array and uploads it to the server:</p>
  
  <pre><code>- (RACSignal *)uploadFormItemAttachments:(NSArray*)pendingAttachments attachmentHeaders:(NSArray*)attachmentHeaders form:(SEFSManagedForm*)form
  {
  
    RACSignal* batchSignal = [RACSignal createSignal:^RACDisposable *(id&lt;RACSubscriber&gt; subscriber) {
      [attachmentHeaders enumerateObjectsUsingBlock:^(SEFSFormItemAttachmentHeader* attachmentHeader, NSUInteger idx, BOOL *stop)
       {
         // Look for the local attachment using attachment header from server
  
         NSPredicate* predicate = [NSPredicate predicateWithFormat:@"identifier = %@", attachmentHeader.document];
         NSArray* foundAttachment = [pendingAttachments filteredArrayUsingPredicate:predicate];
  
         SEFSManagedAttachment* fullAttachment = foundAttachment[0];
  
         RACSignal* uploadFormItemAttachmentSignal = [[self uploadFormItemAttachment:fullAttachment
                                                                    attachmentHeader:attachmentHeader                                                            ] map:^id(NSNumber* value) {
           NSMutableArray* valuesArray = [NSMutableArray array];
           [valuesArray addObject:value];
           [valuesArray addObject:attachmentHeader.document];
           RACTuple* tuple = [RACTuple tupleWithObjectsFromArray:valuesArray
                                              convertNullsToNils:YES];
           return tuple;
         }];
  
  
         [subscriber sendNext:uploadFormItemAttachmentSignal];
       }];
  
      [subscriber sendCompleted];
      return nil;
    }];
  
    return [batchSignal flatten:2];
  }
  </code></pre>