OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
493 stars 262 forks source link

[question]: IdsAvailable deprecated SPM in Objective-C #1479

Open salvatoreboemia opened 2 weeks ago

salvatoreboemia commented 2 weeks ago

How can we help?

Hi

I'm trying to build an old project with Xcode 16

Version Installed: 5.2.4 SPM

Code affected:

[OneSignal IdsAvailable:^(NSString* userId, NSString* pushToken) 
No known class method for selector 'IdsAvailable:'

Changed import with from this to this

#import <OneSignalFramework/OneSignalFramework.h>
to
#import <OneSignal/OneSignal.h>

Could you provide me with some examples of how to replace this deprecated method? I tried also getDeviceState and so on but no works

Thanks

Code of Conduct

EDIT

I tried in this way:

NSString* userId = OneSignal.User.pushSubscription.id;
NSString* pushToken = OneSignal.User.pushSubscription.token;

    if (userId != nil) {
        NSLog(@"OneSignal UserId: %@", userId);
        // todo
        if (pushToken != nil) {
            NSLog(@"OneSignal pushToken: %@", pushToken);

     // todo
        }
    }

But I don't know if is the correct replacement