Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23747] iOS: Handoff crashes from iOS9 to iOS8

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-08-09T23:54:57.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 5.5.0
ComponentsiOS
Labelshandoff, qe-5.4.0, qe-5.5.0
ReporterHarry Bryant
AssigneeHans Knöchel
Created2016-08-08T21:41:37.000+0000
Updated2016-08-16T20:27:02.000+0000

Description

*This is NOT a Regression.* When using the handoff feature between iOS devices, it was found that a titanium app crashes when handing off from an iOS9 device -> iOS8 device. See below: Handing off from iOS9Device1 to iOS9Device2: *iOS9Device1:* Activity moved to a different device. *iOS9Device2:* continueactivity was fired. *Logs:* {color:#d04437}[ERROR] : UIAlertController is up and showing an alert. ABORTING showing of modal controller{color} Handing off from iOS9Device to iOS8Device: *iOS9Device:* Activity moved to a different device. *iOS8Device:* {color:#d04437}App crashes. {color} *Xcode Logs:*
Aug  4 15:31:23 Spam kernel[0] <Notice>: xpcproxy[1079] Container: /private/var/mobile/Containers/Data/Application/326B7AB3-16DB-4C33-94A6-B8BC41EF6A71 (sandbox)
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: SOASTA TouchTest Build : 8244.160
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: SOASTA TouchTest initializing...
Aug  4 15:31:23 Spam locationd[60] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: Process delegate TiApp(o) : TiHost : NSObject
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>:   added ctDidFinishLaunchingWithOptions
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>:   watching application:didFinishLaunchingWithOptions: : success
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>:   added ctOpenURL
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>:   watching openURL : success
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: SOASTA TouchTest initialized in 103 msec (#51)
Aug  4 15:31:23 Spam SamusTheBold[1079] <Error>: assertion failed: 12D508: libxpc.dylib + 71792 [3C982BC2-5B46-305A-9A09-3C3D15332820]: 0x7d
Aug  4 15:31:23 Spam Unknown[1079] <Error>: 
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: [DEBUG] Reading stylesheet from: /private/var/mobile/Containers/Bundle/Application/9A54667A-1524-4020-B04D-7E23BBB19F46/SamusTheBold.app/stylesheet.plist
Aug  4 15:31:23 Spam SamusTheBold[1079] <Warning>: [INFO] SamusTheBold/1.0 (5.4.0.16921ce)
Aug  4 15:31:23 Spam sharingd[59] <Notice>: 15:31:23.340 : Requesting Handoff payload
Aug  4 15:31:23 Spam sharingd[59] <Notice>: 15:31:23.643 : Received a new Handoff advertisement from "SAMWISE"
Aug  4 15:31:23 Spam sharingd[59] <Warning>: [Warning] No delegate was registered that could handle protobuf BC060AC5-021F-4A2D-883F-5FDA9A177137
Aug  4 15:31:23 Spam sharingd[59] <Warning>: [Warning] No delegate was registered that could handle protobuf BC060AC5-021F-4A2D-883F-5FDA9A177137
Aug  4 15:31:23 Spam sharingd[59] <Notice>: 15:31:23.719 : Received requested Handoff payload from "SAMWISE" ((null))
Aug  4 15:31:23 Spam ReportCrash[1080] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
Aug  4 15:31:23 Spam ReportCrash[1080] <Notice>: ReportCrash acting against PID 1079
Aug  4 15:31:23 Spam ReportCrash[1080] <Notice>: Formulating crash report for process SamusTheBold[1079]
Aug  4 15:31:23 Spam SpringBoard[53] <Warning>: BSXPCMessage received error for message: Connection invalid
Aug  4 15:31:23 Spam mediaserverd[22] <Notice>: '' com.appc.SamusTheBold(pid = 1079) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Aug  4 15:31:23 Spam com.apple.xpc.launchd[1] (UIKitApplication:com.appc.SamusTheBold[0xbad1][1079]) <Notice>: Service exited due to signal: Segmentation fault: 11
Aug  4 15:31:23 Spam SpringBoard[53] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Aug  4 15:31:23 Spam SpringBoard[53] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Aug  4 15:31:23 Spam mediaserverd[22] <Notice>: 'FigPlayer - 29' (pid = 29) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Aug  4 15:31:23 Spam ReportCrash[1080] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/SamusTheBold_2016-08-04-153123_Spam.ips
Aug  4 15:31:23 Spam SpringBoard[53] <Warning>: Application 'UIKitApplication:com.appc.SamusTheBold[0xbad1]' crashed.
Aug  4 15:31:23 Spam assertiond[63] <Warning>: pid_suspend failed for <BKNewProcess: 0x154e16170; com.appc.SamusTheBold; pid: 1079; hostpid: -1>: Unknown error: -1, Unknown error: -1
Aug  4 15:31:23 Spam assertiond[63] <Warning>: Could not set priority of <BKNewProcess: 0x154e16170; com.appc.SamusTheBold; pid: 1079; hostpid: -1> to 2, priority: No such process
Aug  4 15:31:23 Spam assertiond[63] <Warning>: Could not set priority of <BKNewProcess: 0x154e16170; com.appc.SamusTheBold; pid: 1079; hostpid: -1> to 4096, priority: No such process
Aug  4 15:31:23 Spam SpringBoard[53] <Warning>: Unable to deliver -[UIRemoteApplication showTopMostMiniAlertWithSynchronizationPort:] message to port 0: (ipc/send) invalid destination port
Aug  4 15:31:23 Spam sharingd[59] <Notice>: 15:31:23.896 : Stopping Handoff scanning
Handing off from iOS8Device to iOS9Device: *iOS8Device:* Activity moved to a different device. *iOS9Device:* continueactivity was fired.

TEST CODE:

Ti.API.info("Creating activity...");
var win = Ti.UI.createWindow();
win.add(Ti.UI.createLabel({text: "Check logs",color: "white"}))
var activity =  Ti.App.iOS.createUserActivity({
    activityType:'com.foo.message',
    title:'Handoff Messenger',
    userInfo:{
        msg: 'Tag! You\'re it!'
    }
});
 
 
//if(!activity.isSupported()){
//    alert('activity is not supported');
//} else {
	Ti.API.info("Activity is supported...");
    activity.becomeCurrent();
//}
 
activity.addEventListener('useractivitywascontinued', function(e) {
    alert('Activity moved to a different device.');
});
 
Ti.App.iOS.addEventListener('continueactivity', function(e){
    alert("continueactivity was fired");
    if (e.activityType === 'com.foo.message' && e.userInfo.msg) {
        Ti.API.info(e.userInfo.msg);
    }
});
 
win.open();
 
/** -- tiapp.xml --
 
<ios>
	<plist>
		<dict>
		<key>NSUserActivityTypes</key>
		<array>
			<string>com.foo.message</string>
			<string>com.foo.bar</string>
		</array>
		</dict>
	</plist>
</ios>
 
**/

Steps to Reproduce

1. Ensure that both iOS8 / iOS9 devices are: - Logged into the same iCloud account. - Connected to the same WiFi Network. - Bluetooth enabled. 2. Create a classic mobile application. 3. Apply the above test code to the app.js file. 4. Run the app to both devices. 5. Launch the app on the iOS9 device. 6. Launch the app through Handoff on the iOS8 device either by: - Swiping up from the app icon present on the lock screen. - Double tapping the home button and selecting the app.

Actual Result

App crashes with no error.

Expected Result

App should handoff from the iOS9 device to the iOS8 device successfully.

Comments

  1. Hans Knöchel 2016-08-09

    Alright, I guess the following is causing the error:
           if( [userActivity.activityType isEqualToString:CSSearchableItemActionType]){
               if([userActivity userInfo] !=nil){
                   [dict setObject:[[userActivity userInfo] objectForKey:CSSearchableItemActivityIdentifier] forKey:@"searchableItemActivityIdentifier"];
               }
           }
       
       
    because isEqualToString:CSSearchableItemActionType is an iOS 9 API. That also explains, why it works from iOS 8 to iOS 9 but not the other way around. Will wrap it properly to be ignored on iOS < 9. Good catch! Additional infos: - Caused by [this PR](https://github.com/appcelerator/titanium_mobile/pull/7081) - Inside the core since the 5.0.0 release - Adjusted the demo-code to log the second debug. That was causing the alert-warning, because the previous alert was already presented.
  2. Hans Knöchel 2016-08-09

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/8201 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8202 Please do a full FT using an iOS 8 and iOS 9 QE-device, thanks!
  3. Hans Knöchel 2016-08-14

    PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8223
  4. Harry Bryant 2016-08-16

    Verified as fixed, Handoff no longer crashes when switching from an iOS9 device to an iOS8 device. Tested On: iPhone 6S (9.3.4, 8.2) Device Mac OSX El Capitan 10.11.6 Ti SDK: 5.5.0.v20160816120242 Appc Studio: 4.7.0.201607250649 Appc NPM: 4.2.7 App CLI: 6.0.0-25 Xcode 8.0 beta 6 (8S193k) Node v4.4.7 *Closing ticket.*

JSON Source