Skip to content

Commit b4bdbe2

Browse files
collinjacksongoderbauer
authored andcommitted
Port fix from github to firebase_database plugin (flutter#39)
1 parent 40b47de commit b4bdbe2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ @interface NSError (FlutterError)
99
@implementation NSError (FlutterError)
1010
- (FlutterError *)flutterError {
1111
return [FlutterError
12-
errorWithCode:[NSString stringWithFormat:@"Error %d", self.code]
12+
errorWithCode:[NSString stringWithFormat:@"Error %ld", self.code]
1313
message:self.domain
1414
details:self.localizedDescription];
1515
}
@@ -24,6 +24,13 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
2424
binaryMessenger:[registrar messenger]];
2525
FirebaseDatabasePlugin *instance = [[FirebaseDatabasePlugin alloc] init];
2626
[registrar addMethodCallDelegate:instance channel:channel];
27+
// TODO(jackson): stub code that should be replaced with dynamic registration.
28+
[[[FIRDatabase database].reference queryLimitedToLast:10]
29+
observeEventType:FIRDataEventTypeChildAdded
30+
withBlock:^(FIRDataSnapshot *_Nonnull snapshot) {
31+
[channel invokeMethod:@"DatabaseReference#childAdded"
32+
arguments:@[ snapshot.key, snapshot.value ]];
33+
}];
2734
}
2835

2936
- (instancetype)init {
@@ -32,12 +39,6 @@ - (instancetype)init {
3239
if (![FIRApp defaultApp]) {
3340
[FIRApp configure];
3441
}
35-
[[[FIRDatabase database].reference queryLimitedToLast:10]
36-
observeEventType:FIRDataEventTypeChildAdded
37-
withBlock:^(FIRDataSnapshot *_Nonnull snapshot) {
38-
[channel invokeMethod:@"DatabaseReference#childAdded"
39-
arguments:@[ snapshot.key, snapshot.value ]];
40-
}];
4142
}
4243
return self;
4344
}

0 commit comments

Comments
 (0)