[TIMOB-28491] iOS: Setter not called properly anymore
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-06-22T15:30:32.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.0.1 |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Jan Vennemann |
Created | 2021-06-12T16:01:16.000+0000 |
Updated | 2021-06-22T15:30:32.000+0000 |
Description
It seems like the iOS setters in modules are not called correctly anymore. I remember I brought this up a few months ago, but it actually seems like it made it into the 10.0.0.GA as well, breaking basically all modules that have properties like this (ti.facebook example):
- (void)setPermissions:(NSArray<NSString *> *_Nullable)permissions
{
_permissions = permissions;
}
The setter is only triggered if called via facebook.setPermissions(['email])
, the prior (and better) way, facebook.permissions = ['email']
does not work anymore, so Facebooks logins don't include the permission anymore and therefore fail.
[~hknoechel], I'm trying to see if there's some context from the previous ticket but I can't seem to find it (closest I could find is TIMOB-28415) [~cwilliams], [~jvennemann], I'm not familiar with this. Is it this an unfortunate consequence of the automatic setters removal where we're no longer generating the property here? Is there some form of compatibility we could add to handle this?
I mean, the setters are fine to be removed. But I was not sure why it can't even be accessed via the set-property anymore. Titanium always used the "setXXX" in native code to handle both setter and set-properties, so maybe a bit too much was removed. On the other hand, it seems like the SDK itself is not affected by this.
Long story short, when I tried to unify the underlying require implementations between iOS/Android, this bug came about. Native modules got wrapped in a "wrapper" object that forwarded method invocations. This is necessary for shuttling around "scope variables" to Android proxies - primary the
sourceURL
used to resolve relative paths (relative to the proxy creation file). Looks like this wrapper object is unnecessary for iOS and inadvertently causes this bug. I believe [~jvennemann] is going to basically just skip the wrapping on iOS.Thanks for the explanation [~cwilliams]. Yep, that's basically what i did ;) PR: https://github.com/appcelerator/titanium_mobile/pull/12900
master and 10_0_X backport merged