{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1939","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1939/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1939/comments","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1939/events","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1939","id":70807664,"number":1939,"title":"returning RACSignal from flattenMap results in assertion failure saying RACDynamicSignal is not a stream.","user":{"login":"amccarri","id":540984,"avatar_url":"https://avatars.githubusercontent.com/u/540984?v=3","gravatar_id":"","url":"https://api.github.com/users/amccarri","html_url":"https://github.com/amccarri","followers_url":"https://api.github.com/users/amccarri/followers","following_url":"https://api.github.com/users/amccarri/following{/other_user}","gists_url":"https://api.github.com/users/amccarri/gists{/gist_id}","starred_url":"https://api.github.com/users/amccarri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amccarri/subscriptions","organizations_url":"https://api.github.com/users/amccarri/orgs","repos_url":"https://api.github.com/users/amccarri/repos","events_url":"https://api.github.com/users/amccarri/events{/privacy}","received_events_url":"https://api.github.com/users/amccarri/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-24T22:17:36Z","updated_at":"2015-05-03T22:13:35Z","closed_at":"2015-05-03T22:13:35Z","body":"Getting following when trying to unit test some RAC code.  Calling code looks like this:\r\n\r\n```objective-c\r\n    [[[[[self.session connect] filter:^BOOL(NSNumber *connected) {\r\n        return connected.boolValue; // only care about successful connection\r\n    }] flattenMap:^RACStream *(id value) {\r\n        return [self.session authenticate];\r\n    }] flattenMap:^RACStream *(NSNumber *authenticated) {\r\n        XCTAssertTrue(authenticated.boolValue);\r\n        return [self.session startup]; // this is where it fails, returning any RACSignal causes the assertion fail\r\n    }] subscribeNext:^(id message) {\r\n        XCTAssertTrue([message isKindOfClass:XMPPIQ.class], @\"response message was not XMPPMessage\");\r\n        NSLog(@\"received response %@\", message);\r\n        [startupExpectation fulfill];\r\n    }];\r\n```\r\n\r\n```\r\n...Pods/ReactiveCocoa/ReactiveCocoa/RACStream.m:75\r\n2015-04-24 17:12:47.738 xctest[43199:5350331] \u001B[31m*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Value returned from -flattenMap: is not a stream: ACDynamicSignal: 0x7fb11b411d10> name: '\r\n*** First throw call stack:\r\n(\r\n\t0   CoreFoundation                      0x0000000101ad7f35 __exceptionPreprocess + 165\r\n\t1   libobjc.A.dylib                     0x0000000101772bb7 objc_exception_throw + 45\r\n\t2   CoreFoundation                      0x0000000101ad7d9a +[NSException raise:format:arguments:] + 106\r\n\t3   Foundation                          0x00000001013906a7 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169\r\n\t4   HipChatSDKTests                     0x00000001032d13a0 __36-[RACStream(Operations) flattenMap:]_block_invoke_2 + 528\r\n\t5   HipChatSDKTests                     0x00000001032c9d02 __29-[RACSignal(RACStream) bind:]_block_invoke125 + 130\r\n\t6   HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t7   HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t8   HipChatSDKTests                     0x00000001032c9814 __29-[RACSignal(RACStream) bind:]_block_invoke_298 + 68\r\n\t9   HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t10  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t11  HipChatSDKTests                     0x00000001032c9814 __29-[RACSignal(RACStream) bind:]_block_invoke_298 + 68\r\n\t12  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t13  HipChatSDKTests                     0x000000010329d111 __29-[RACReturnSignal subscribe:]_block_invoke + 81\r\n\t14  HipChatSDKTests                     0x00000001032da3be -[RACSubscriptionScheduler schedule:] + 478\r\n\t15  HipChatSDKTests                     0x000000010329d043 -[RACReturnSignal subscribe:] + 515\r\n\t16  HipChatSDKTests                     0x00000001032cd71d -[RACSignal(Subscription) subscribeNext:error:completed:] + 1133\r\n\t17  HipChatSDKTests                     0x00000001032c96c9 __29-[RACSignal(RACStream) bind:]_block_invoke88 + 777\r\n\t18  HipChatSDKTests                     0x00000001032c9d3a __29-[RACSignal(RACStream) bind:]_block_invoke125 + 186\r\n\t19  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t20  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t21  HipChatSDKTests                     0x00000001032c9814 __29-[RACSignal(RACStream) bind:]_block_invoke_298 + 68\r\n\t22  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t23  HipChatSDKTests                     0x000000010329d111 __29-[RACReturnSignal subscribe:]_block_invoke + 81\r\n\t24  HipChatSDKTests                     0x00000001032da3be -[RACSubscriptionScheduler schedule:] + 478\r\n\t25  HipChatSDKTests                     0x000000010329d043 -[RACReturnSignal subscribe:] + 515\r\n\t26  HipChatSDKTests                     0x00000001032cd71d -[RACSignal(Subscription) subscribeNext:error:completed:] + 1133\r\n\t27  HipChatSDKTests                     0x00000001032c96c9 __29-[RACSignal(RACStream) bind:]_block_invoke88 + 777\r\n\t28  HipChatSDKTests                     0x00000001032c9d3a __29-[RACSignal(RACStream) bind:]_block_invoke125 + 186\r\n\t29  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t30  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t31  HipChatSDKTests                     0x00000001032c9814 __29-[RACSignal(RACStream) bind:]_block_invoke_298 + 68\r\n\t32  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t33  HipChatSDKTests                     0x000000010329d111 __29-[RACReturnSignal subscribe:]_block_invoke + 81\r\n\t34  HipChatSDKTests                     0x00000001032da3be -[RACSubscriptionScheduler schedule:] + 478\r\n\t35  HipChatSDKTests                     0x000000010329d043 -[RACReturnSignal subscribe:] + 515\r\n\t36  HipChatSDKTests                     0x00000001032cd71d -[RACSignal(Subscription) subscribeNext:error:completed:] + 1133\r\n\t37  HipChatSDKTests                     0x00000001032c96c9 __29-[RACSignal(RACStream) bind:]_block_invoke88 + 777\r\n\t38  HipChatSDKTests                     0x00000001032c9d3a __29-[RACSignal(RACStream) bind:]_block_invoke125 + 186\r\n\t39  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t40  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t41  HipChatSDKTests                     0x00000001032b5284 __35-[RACSignal(Operations) takeUntil:]_block_invoke568 + 68\r\n\t42  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t43  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t44  HipChatSDKTests                     0x000000010327d392 __84-[NSObject(RACPropertySubscribing) rac_valuesAndChangesForKeyPath:options:observer:]_block_invoke48 + 498\r\n\t45  HipChatSDKTests                     0x00000001032796f6 __69-[NSObject(RACKVOWrapper) rac_observeKeyPath:options:observer:block:]_block_invoke75 + 774\r\n\t46  HipChatSDKTests                     0x000000010329854e -[RACKVOTrampoline observeValueForKeyPath:ofObject:change:context:] + 590\r\n\t47  HipChatSDKTests                     0x00000001032973a5 -[RACKVOProxy observeValueForKeyPath:ofObject:change:context:] + 517\r\n\t48  Foundation                          0x00000001012d79a6 NSKeyValueNotifyObserver + 356\r\n\t49  Foundation                          0x00000001012d6bcd NSKeyValueDidChange + 466\r\n\t50  Foundation                          0x00000001012db28f -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 118\r\n\t51  Foundation                          0x00000001013107b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259\r\n\t52  HipChatSDKTests                     0x00000001032b38f1 __54-[RACSignal(Operations) setKeyPath:onObject:nilValue:]_block_invoke + 161\r\n\t53  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t54  HipChatSDKTests                     0x000000010329996c -[RACPassthroughSubscriber sendNext:] + 444\r\n\t55  HipChatSDKTests                     0x00000001032c9814 __29-[RACSignal(RACStream) bind:]_block_invoke_298 + 68\r\n\t56  HipChatSDKTests                     0x00000001032d952f -[RACSubscriber sendNext:] + 239\r\n\t57  HipChatSDKTests                     0x000000010329d111 __29-[RACReturnSignal subscribe:]_block_invoke + 81\r\n\t58  HipChatSDKTests                     0x000000010329f0ee -[RACScheduler performAsCurrentScheduler:] + 510\r\n\t59  HipChatSDKTests                     0x000000010329a8f4 __30-[RACQueueScheduler schedule:]_block_invoke + 84\r\n\t60  libdispatch.dylib                   0x0000000102d36af6 _dispatch_call_block_and_release + 12\r\n\t61  libdispatch.dylib                   0x0000000102d50af4 _dispatch_client_callout + 8\r\n\t62  libdispatch.dylib                   0x0000000102d3b8cf _dispatch_queue_drain + 733\r\n\t63  libdispatch.dylib                   0x0000000102d3b494 _dispatch_queue_invoke + 217\r\n\t64  libdispatch.dylib                   0x0000000102d3d3fa _dispatch_root_queue_drain + 479\r\n\t65  libdispatch.dylib                   0x0000000102d3e2c9 _dispatch_worker_thread3 + 98\r\n\t66  libsystem_pthread.dylib             0x00000001030b8637 _pthread_wqthread + 729\r\n\t67  libsystem_pthread.dylib             0x00000001030b640d start_wqthread + 13\r\n```"},"comment":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/comments/98549987","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1939#issuecomment-98549987","issue_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1939","id":98549987,"user":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":true},"created_at":"2015-05-03T22:13:35Z","updated_at":"2015-05-03T22:13:35Z","body":"This definitely sounds like some kind of double linkage issue. Unfortunately, we don't use CocoaPods ourselves, so I'm afraid we're ill-equipped to help you resolve it.\r\n\r\nIn any case, this doesn't sound like a RAC issue, because the assertion is correct as written. :confused: "}}