Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28491] iOS: Setter not called properly anymore

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2021-06-22T15:30:32.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.1
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeJan Vennemann
Created2021-06-12T16:01:16.000+0000
Updated2021-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.

Comments

  1. Ewan Harris 2021-06-15

    [~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?
  2. Hans Knöchel 2021-06-15

    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.
  3. Christopher Williams 2021-06-16

    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.
  4. Jan Vennemann 2021-06-16

    Thanks for the explanation [~cwilliams]. Yep, that's basically what i did ;) PR: https://github.com/appcelerator/titanium_mobile/pull/12900
  5. Ewan Harris 2021-06-22

    master and 10_0_X backport merged

JSON Source