iOS Question Create a WhatsApp Stickers App

asales

Expert
Licensed User
Longtime User
With a help of ChatGPT I'm trying to create an iOS Sticker App for WhatsApp based in this link:
1764263723515.png

The project (so far) is in attach.

I'm using the Hosted Builder and I get this error:
error: 'StickerPackManager.h' file not found
The actual file is "StickerPackManager.swift"

How can I proceed with this project?

Thanks in advance for any tips.


1. Practical path (what you need to do)
1.1. Prepare the assets and the sticker_packs.wasticker file

This part is identical to the official iOS sample:
  • Follow the official image rules (512×512, <100 KB, 3–30 stickers, 96×96 tray icon).
  • Create the sticker_packs.wasticker file (a JSON-based metadata file) containing:
    • identifier (the pack ID),
    • name,
    • publisher,
    • tray_image_file,
    • list of image_file items.
You can even use Android-side JSON/pack generators as long as you adjust the fields to match the iOS structure.



1.2. Integrate the WhatsApp sample project into the Xcode project generated by B4i

Typical workflow:

  1. In B4i, generate a Release build and download the app’s Xcode project.
  2. Open the generated Xcode project.
  3. Inside Xcode, add the folders/classes from the WAStickersThirdParty iOS sample (or at least the core files such as Sticker.swift, StickerPack.swift, StickerPackManager, etc.).
  4. Copy the following into your app bundle:
    • all sticker images,
    • the sticker_packs.wasticker file.
  5. In your Info.plist, add:
'<key>LSApplicationQueriesSchemes</key>
'<array>
'<string>whatsapp</string>
'</array>
#QueriesSchemes: whatsapp

This allows the app to open the whatsapp:// URL scheme on iOS.



1.3. Create an Objective-C wrapper usable from B4i

In B4i, you can embed inline Objective-C code using #If OBJC.
Your goal is to expose a simple method that invokes the same logic used by the “Add to WhatsApp” button in the official iOS sample.

Example:

B4i side:
B4X:
Sub AddStickerPackToWhatsApp (Identifier As String, Name As String)
  Dim no As NativeObject = Me
  no.RunMethod("addStickerPackToWhatsApp::", Array(Identifier, Name))
End Sub

Sub btnAdd_Click
  Dim packId As String = "my_pack_01"
  Dim packName As String = "Cuppy Stickers"
  AddStickerPackToWhatsApp(packId, packName)
End Sub

Objective-C wrapper inside the same B4i module:
B4X:
#If OBJC
#import "StickerPackManager.h" // or the equivalent header from WAStickersThirdParty
- (void)addStickerPackToWhatsApp:(NSString *)identifier :(NSString *)name {
// You will copy/adapt this code from the official iOS sample.
// Example logic:
//
// StickerPack *pack = [StickerPackManager stickerPackWithIdentifier:identifier];
// if (pack) {
// [StickerPackManager addStickerPackToWhatsApp:pack
// completionHandler:^(BOOL success, NSError *error) {
// // Optional: handle callback
// }];
// }
}
#End If

The main implementation inside addStickerPackToWhatsApp must be copied from the original Sample Project, since that’s the code that builds and validates the sticker pack and triggers WhatsApp import.
 

Attachments

  • WAStickers.zip
    227.3 KB · Views: 10
Last edited:
Top