Changelog (since 1.6.0)
- Fix crash on iOS 14 beta
- Build with Xcode 11.6 (so you can submit the app to app store and get it ready before iOS 14 is released)
- Update bindings for iOS 13.6
- Fix a crash when debugging in Android Studio when there is a Objective-C block callback
- The screen unlock checking is working properly when running the app from AS on iOS 13+ device.
- (Almost) all parameters of Objective-C block bindings now have proper parameter names instead of the boring and meaningless “arg0”, “arg1”, “arg2”…
- Generating bindings for Obj-C blocks that have parameters that are also blocks is now supported (this issue is identified in iOS TableView swipe UIContextualAction, thanks @sebastian)
Details
Earlier versions have a bug that if you debugging your java code in AS/Intellij and if you put a break point inside a function that takes block as parameter:
@Override
public void URLSessionDidReceiveChallengeCompletionHandler(NSURLSession session, NSURLAuthenticationChallenge challenge, Block_URLSessionDidReceiveChallengeCompletionHandler completionHandler)
{
do_something(); // <- breakpoint here
}
and when code reaches here and hit the breakpoint, the app will crash immediately. This issue is caused by debugger calling completionHandler.toString()
which is not properly handled by the natj library. This version solves this problem.
For Objective-C APIs like
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError *error))completionHandler;
The old natj generates java binding for the completionHandler
block like
@Runtime(ObjCRuntime.class)
@Generated
public interface Block_downloadTaskWithRequestCompletionHandler {
@Generated
void call_downloadTaskWithRequestCompletionHandler(NSURL arg0, NSURLResponse arg1, NSError arg2);
}
and the parameter names are completely missing. This update (mostly) solves this issue so the parameter names are preserved:
@Runtime(ObjCRuntime.class)
@Generated
public interface Block_downloadTaskWithRequestCompletionHandler {
@Generated
void call_downloadTaskWithRequestCompletionHandler(NSURL location, NSURLResponse response, NSError error);
}
This change does not affect any of your app code, it just make the IDE’s code completion more useable.
Install / Upgrade
Simply change you build script to use the new plugin and SDK:
buildscript {
dependencies {
classpath group: 'org.multi-os-engine.community', name: 'moe-gradle', version: '1.7.0'
}
}