Facebook Instant Games调用排行榜接口出现LEADERBOARD_NOT_FOUND错误求助
Hey there, let’s work through this leaderboard issue you’re hitting—super common stuff once you know the ins and outs of Facebook Instant Games! Let’s break down your questions one by one:
LEADERBOARD_NOT_FOUND First off, that error means exactly what it says: Facebook’s servers can’t find a leaderboard named "test" linked to your app. The most likely culprits are either:
- You haven’t created this leaderboard in your Facebook app dashboard yet, or
- The name in your code doesn’t exactly match the name you set in the dashboard (it’s case-sensitive!)
Your code structure is right, but there are a few critical details to nail down:
- Always wait for
FBInstant.initializeAsync()to complete before trying to access leaderboards—this ensures the SDK is fully set up to communicate with Facebook’s servers. - Double-check the leaderboard name matches what’s in the dashboard (no typos, correct capitalization).
Here’s a polished version of your code with proper initialization handling:
// Wait for SDK to initialize first FBInstant.initializeAsync() .then(() => { // Now fetch the leaderboard return FBInstant.getLeaderboardAsync('test'); }) .then(leaderboard => { console.log('Found leaderboard:', leaderboard.getName()); // Add your logic here (fetch ranks, submit scores, etc.) }) .catch(error => { console.error('Failed to load leaderboard:', error); });
- Hosting status: As long as you’ve created the leaderboard in your dashboard and set it to Active, it’s hosted and ready to use. Just make sure your Instant Game is properly uploaded and hosted on Facebook’s servers (you should’ve completed this during app setup).
- App review: You don’t need to submit your app for review to test leaderboards! But this only works for developer, tester, or admin accounts linked to your app. Regular user accounts won’t be able to access leaderboards until your app is approved, but your own dev account should work immediately after creating the leaderboard.
- Verify your app ID: Make sure the app ID in your game code matches the one in the Facebook dashboard where you created the leaderboard (it’s easy to accidentally use a test app ID instead of the main one).
- Clear browser cache: Sometimes old app configs get cached, so clearing your browser’s cache and reloading the game can help pick up newly created leaderboards.
Side note: That error message you shared confirms the SDK is working—it just can’t locate the specific leaderboard you’re asking for. Fixing the dashboard setup or name match should resolve this immediately!
内容的提问来源于stack exchange,提问作者World Affairs

