Launching my app with a specific activity

I've managed to get the lesson data populated as described (thanks, the documentation was pretty clear, although the Objective-C version still shows swift code).


When I swap to student mode, and relaunch the Schoolwork app, I can then double tap on the activity and it launches my app quite happily.


What I haven't found described so far, is how my app determines what activity or CLSContext was requested so that I can direct the student into the requested content automatically.


I'm guessing I can find it in the "launchOptions" dictionary provided to:


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;


Any help would be appreciated.

Accepted Reply

You basically encode the path to your context or a context id in the URL you assign to your CLSContext object.


For the app delegate details, check out how to format and handle universal links here: https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html


Specifically:

After you specify your associated domains, adopt the

UIApplicationDelegate
methods for Handoff (specifically
application:continueUserActivity:restorationHandler:
) so that your app can receive a link and handle it appropriately.


-M

Replies

You basically encode the path to your context or a context id in the URL you assign to your CLSContext object.


For the app delegate details, check out how to format and handle universal links here: https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html


Specifically:

After you specify your associated domains, adopt the

UIApplicationDelegate
methods for Handoff (specifically
application:continueUserActivity:restorationHandler:
) so that your app can receive a link and handle it appropriately.


-M

Thank you. I found the sample project last thing last night and was able to see that to be the mechanism. I guess it's just a gap in the documentation.


-P

You actually have two options for how to send students directly to an assignment's content; Universal Links as mentioned or `NSUserActivity`. The doc is a little burried for these options but it does exist: https://developer.apple.com/documentation/classkit/clscontext/linking_directly_to_assignments (you have to go to the article about advertising your content and then find the above article at the bottom of the page.)

Thank you for pointing that out. To be honest, I'd have expected this to at least be linked to from the Incorporating ClassKit into an Educational App page (https://developer.apple.com/documentation/classkit/incorporating_classkit_into_an_educational_app)