[TIMOB-19441] useractivitywillsave does not fire before continuing on other device
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-09-03T08:09:30.000+0000 |
Affected Version/s | Release 5.0.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | handoff |
Reporter | Fokke Zandbergen |
Assignee | Eric Merriman |
Created | 2015-08-31T15:03:55.000+0000 |
Updated | 2017-03-20T21:42:36.000+0000 |
Description
The [Ti 5.0 sample app](https://github.com/appcelerator-developer-relations/appc-sample-ti500) will show that the
useractivitywillsave
event only fires when you call becomeCurrent()
. It does not fire before/when you continue the activity on another device, like the [docs](https://appcelerator.github.io/appc-docs/latest/#!/api/Titanium.App.iOS.UserActivity-property-needsSave) say it will when you set needSave
to true
. This leaves you with no way to update the activity before the other devices takes over.
I ran some tests that showed that
useractivitywillsave
will fire when: * You callbecomeCurrent()
on an activity. * Before the current activity is sent for continuation on another devices ([as Apple says](https://developer.apple.com/library/prerelease/ios/documentation/Foundation/Reference/NSUserActivity_Class/#//apple_ref/occ/instp/NSUserActivity/needsSave)) but *only* if since that activity became current you have made a change (updateduserInfo
) to it. This is weird, since you'd expect the event would give you the chance to (only then) update the activity with e.g. the current text of the email you were composing. If you have to update the activity in order for the event to fire, then what is there left to do when it gets called?From Apple's [Handoff Programming Guide: Best Practices](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/Handoff/AdoptingHandoff/AdoptingHandoff.html#//apple_ref/doc/uid/TP40014338-CH2-SW14): {quote}To update the activity object’s userInfo dictionary efficiently, configure its delegate and set its needsSave property to YES whenever the userInfo needs updating. At appropriate times, Handoff invokes the delegate’s userActivityWillSave: callback, and the delegate can update the activity state.{quote} [This StackOverflow answer](http://stackoverflow.com/a/26792196/4626813) has a sample that demonstrates this:
So it seems we (and Apple:)) should update our guide/reference to make clear that you need to call
needsSave
every time you have a change and then update the activity with the actual change when asked via theuseractivitywillsave
event.Thanks Fokke. closing as invalid and will open a tidoc ticket.
Closing ticket as invalid.