iOS Shuttle Usage - skpdi/sentinel-document GitHub Wiki
This is how to use the Shuttle library for iOS created on the Sentinel Log Definitions page.
Shuttle for iOS offers Objective-C(.h
, .m
) / Swift(.swift
) files.
The Swift file will be contained in iOS Shuttle files which is built after June 25, 2019. Previously built versions only contain Objective-C files.
We recommend using .h
, .m
format Shuttle files.
// Create Shuttle Instance
SampleSentinelShuttle *shuttle = [[SampleSentinelShuttle alloc] init];
// Setting the field (column) value
// You can use the setter method that the name is same as the column name that you need to record
// For example, if you need to record 'page_id' value, use 'page_id' method.
[shuttle page_id:@"/main/card/list"];
[shuttle action_id:@"tap.my_card"];
// However, it is recommended to use setBodyOf method rather than the method above.
// This is because if you use like the above, calling a method could be omitted by accident.
// Since setBodyOf method must transfer all the necessary columns to parameter, the columns would not be omitted.
// If you use setBodyOf method, page_id, action_id are recorded automatically.
[shuttle setBodyOfMain_card_list__tap_my_card__with__serial_no:@"2012-3XXX-XXXX-XXXX" card:nil date:@"MM/YY"];
//You need to chaining by yourself for other Header values.
[[shuttle session_Id:@"AF0EF"] setBodyOfMain_card_list__tap_my_card__with__serial_no:@"2012-3XXX-XXXX-XXXX" card:nil date:@"MM/YY"];
Use the code below to transfer Shuttle that values are entered to Rake iPhone. ( Refer to Rake-iPhone API )
[rake track:[shuttle toNSDictionary]];
toJSONString
method can be used for debugging.
NSLog(@"%@",[shuttle toJSONString]);
We recommend using .swift
format Shuttle file.
// Create Shuttle Instance
let shuttle = SampleSentinelShuttle()
// Setting the field (column) value
// You can use the setter method that the name is same as the column name that you need to record
// For example, if you need to record 'page_id' value, use 'page_id' method.
shuttle.page_id("/main/card/list")
shuttle.action_id("tap.my_card")
// However, it is recommended to use setBodyOf method rather than the method above.
// This is because if you use like the above, calling a method could be omitted by accident.
// Since setBodyOf method must transfer all the necessary columns to parameter, the columns would not be omitted.
// If you use setBodyOf method, page_id, action_id are recorded automatically.
[shuttle setBodyOfMain_card_list__tap_my_card__(serial_no: "2012-3XXX-XXXX-XXXX", card: nil, date: "MM/YY");
//You need to chaining by yourself for other Header values.
shuttle.session_Id("AF0EF")
.setBodyOfMain_card_list__tap_my_card__(serial_no: "2012-3XXX-XXXX-XXXX", card: nil, date: "MM/YY")
Use the code below to transfer Shuttle that values are entered to Rake iPhone. ( Refer to Rake-iPhone API )
do {
...
// When you call toDictionary() you should wrap the method by do-try-catch
try rake?.track(shuttle.toDictionary())
} catch let error {
print("\(error)")
}
toJSONString
method can be used for debugging.
print("\(shuttle.toJSONString())")