Skip to content

Commit 139d3c9

Browse files
committed
fix crash
1 parent f963069 commit 139d3c9

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

dart_native/example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ EXTERNAL SOURCES:
2727
SPEC CHECKSUMS:
2828
ClassWrittenInSwift: de0543e7c1a836e190af74fddff84ad9b2f3d18c
2929
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
30-
dart_native: 3ed31c9e40530ad0ae006c0b7cf75a22b24e933f
31-
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
30+
dart_native: c3ea08ad1316564dac6dd66c659b743b958a1813
31+
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
3232

3333
PODFILE CHECKSUM: 6e9979e89c4dd9698b3ed55a88e6a5100fa0dc38
3434

35-
COCOAPODS: 1.11.2
35+
COCOAPODS: 1.11.3

dart_native/example/ios/Runner/DNInterfaceDemo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ @implementation DNInterfaceDemo
2121
[self invokeMethod:@"totalCost"
2222
arguments:@[@0.123456789, @10, @[@"testArray"]]
2323
result:^(id _Nullable result, NSError * _Nullable error) {
24-
NSLog(@"%@", result);
24+
NSLog(@"fuck %@ %@", result, error);
2525
}];
2626
return [NSString stringWithFormat:@"hello %@!", str];
2727
}

dart_native/example/ios/Runner/Runner-Bridging-Header.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
// Use this file to import your target's public headers that you would like to expose to Swift.
33
//
44

5+
#import "DNInterfaceDemo.h"

dart_native/example/ios/Runner/RuntimeStub.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ - (void)fooNSDictionaryBlock:(NSDictionary *(^)(NSDictionary *dict))block {
268268

269269
- (void)fooDelegate:(id<SampleDelegate>)delegate {
270270
DDLogInfo(@"%s arg: %@", __FUNCTION__, delegate);
271-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
271+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
272272
NSString *result = [delegate callback];
273273
DDLogInfo(@"%s callback result:%@", __FUNCTION__, result);
274274
});

dart_native/example/ios/Runner/SwiftStub.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import UIKit
99
#elseif os(macOS)
1010
import AppKit
1111
#endif
12+
import dart_native
1213

1314
@objcMembers
1415
class SwiftStub: NSObject {
@@ -24,6 +25,9 @@ class SwiftStub: NSObject {
2425
}
2526

2627
func fooString(_ str: String) -> String {
28+
DNInterfaceDemo.invokeMethod("totalCost", arguments: [0.123456789, 10, ["testArray"]]) { result, error in
29+
print("fuck \(result.debugDescription) \(error.debugDescription)")
30+
}
2731
return "\(str) DartNative!"
2832
}
2933

dart_native/ios/Classes/native_runtime.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ void NotifyBlockInvokeToDart(DNInvocation *invocation,
759759
}
760760

761761
BlockFunctionPointer function = creator.function;
762-
const Work work = [function, numberOfArguments, isVoid, shouldReturnAsync, &sema, &creator, &invocation]() {
762+
const Work work = [function, numberOfArguments, isVoid, shouldReturnAsync, &sema, creator, invocation]() {
763763
function(invocation.realArgs,
764764
invocation.realRetValue,
765765
numberOfArguments,
@@ -795,7 +795,7 @@ void NotifyMethodPerformToDart(DNInvocation *invocation,
795795
NSSet<NSNumber *> *dartPorts = dealloc.dartPorts;
796796
for (NSNumber *port in dartPorts) {
797797
NativeMethodCallback callback = (NativeMethodCallback)callbackForDartPort[port].integerValue;
798-
const Work work = [callback, numberOfArguments, types, &group, &methodIMP, &invocation]() {
798+
const Work work = [callback, numberOfArguments, types, &group, methodIMP, invocation]() {
799799
callback(invocation.realArgs,
800800
invocation.realRetValue,
801801
numberOfArguments,

dart_native/ios/dart_native.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Write native code using Dart. This package liberates you from undercompetent cha
1515
s.source = { :path => '.' }
1616

1717
# iOS Debug
18-
# s.ios.source_files = 'Classes/**/*', 'common/**/*'
19-
# s.ios.vendored_frameworks = 'libffi.xcframework'
18+
s.ios.source_files = 'Classes/**/*', 'common/**/*'
19+
s.ios.vendored_frameworks = 'libffi.xcframework'
2020

2121
# iOS Release
22-
s.ios.source_files = 'Classes/DartNativePlugin.*', 'Classes/DNInterfaceRegistry.*'
23-
s.ios.vendored_frameworks = 'DartNative.xcframework'
22+
# s.ios.source_files = 'Classes/DartNativePlugin.*', 'Classes/DNInterfaceRegistry.*'
23+
# s.ios.vendored_frameworks = 'DartNative.xcframework'
2424

2525
s.public_header_files = 'Classes/DartNativePlugin.h', 'Classes/DNInterfaceRegistry.h'
2626

0 commit comments

Comments
 (0)