goal c – App shortcut actions not displaying on iOS 18 shortcuts app


First, apology if my English is just not fairly good.
We have now developed an iOS app in objective-C and added integrations for shortcuts app – extra particular the “automation” a part of the app.
Principally, consumer opens shortcuts app, choose automation and when scanning NFC tag, consumer can choose an motion and our app reveals 3 completely different actions. Person choose motion, opens the app and motion is executed. That every one accomplished in Obj-C and was working very effectively with no complaints until customers begin to replace to iOS18.
Now, when consumer begins so as to add automation, solely factor they will do is choose “open app”. Our app actions usually are not displaying any extra. Is there one thing new in iOS 18 now we have to replace our app.
I do know Obje-C is taken into account “previous”, however the price of upgrading an current app and time is just not out there for the time being.

This is a code snippet of out shortcutIntent:





    com.apple.safety.application-groups
    
        group.lw.grp1
        group.lw.grp2
    


Data-plist





    NSExtension
    
        NSExtensionAttributes
        
            IntentsRestrictedWhileLocked
            
            IntentsRestrictedWhileProtectedDataUnavailable
            
            IntentsSupported
            
                LockIntent
                TrunkIntent
                UnlockIntent
            
        
        NSExtensionPointIdentifier
        com.apple.intents-service
        NSExtensionPrincipalClass
        IntentHandler
    


IntentHandler

@implementation IntentHandler

-(id)init{
    self = [super init];
    self.began = false;
    self.handler = [[AppIntentHandler alloc] init];
    self.handler.userInfo = [[NSMutableDictionary alloc] init];
    return self;
}
- (id)handlerForIntent:(INIntent *)intent {
    // That is the default implementation.  If you need completely different objects to deal with completely different intents,
    // you'll be able to override this and return the handler you need for that exact intent.
                   
    
    if(!self.began){
        self.began = YES;
        if([intent isKindOfClass:[LockIntent class]]){
            NSLog(@"*intent lock chosen*");
            self.handler.userInfo = [self assignUserInfo:@"lock"];
        }else if([intent isKindOfClass:[UnlockIntent class]]){
            NSLog(@"*intent unlock chosen*");
            self.handler.userInfo = [self assignUserInfo:@"unlock"];
        }else if([intent isKindOfClass:[TrunkIntent class]]){
            NSLog(@"*intent trunk chosen*");
            self.handler.userInfo = [self assignUserInfo:@"trunk"];
        }
    }else{
        self.began = NO;
    }
    
    
    return self.handler;
}

A customized class to deal with every intent

@interface AppIntentHandler : NSObject
@implementation AppIntentHandler

#pragma mark - response handlers
- (void)handleLock:(nonnull LockIntent *)intent completion:(nonnull void (^)(LockIntentResponse * _Nonnull))completion {
    LockIntentResponse *response = [[LockIntentResponse alloc] initWithCode:LockIntentResponseCodeContinueInApp userActivity:[self lockUserActivity]];
    completion(response);
}

- (void)handleUnlock:(nonnull UnlockIntent *)intent completion:(nonnull void (^)(UnlockIntentResponse * _Nonnull))completion {
    UnlockIntentResponse *response = [[UnlockIntentResponse alloc] initWithCode:UnlockIntentResponseCodeContinueInApp userActivity:[self unlockUserActivity]];
    completion(response);
}

- (void)handleTrunk:(nonnull TrunkIntent *)intent completion:(nonnull void (^)(TrunkIntentResponse * _Nonnull))completion {
    TrunkIntentResponse *response = [[TrunkIntentResponse alloc] initWithCode:TrunkIntentResponseCodeContinueInApp userActivity:[self trunkUserActivity]];
    completion(response);
}

What must be accomplished to make our app’s actions present in shortcuts app once more.
Thanks prematurely

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles