How to use devices field of the user table in FQL query?

冷暖自知 提交于 2019-12-04 18:30:52

Just found out that it IS possible! You can use the IN operator just with the devices column. There is no need to restrict to os or hardware.

Example: all friends that have an iPhone: try out

SELECT uid, name, devices FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
  AND "iPhone" IN devices
ORDER BY profile_update_time DESC 
LIMIT 0, 100

Example: all friends that have an iOS device (e.g. iPhone or iPad): try out

SELECT uid, name, devices FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
  AND "iOS" IN devices
ORDER BY profile_update_time DESC 
LIMIT 0, 100

Hint: If you want to use this Query to build a custom Friend Picker to send invites to Facebook friends that not yet have installed your iOS app but have an iOS device, you want to include the following into your WHERE clause:

AND is_app_user = 0

This does not appear to be possible on the server side. The devices field is returned as an array, and FQL does not seem to have any methods that can search an array. As far as I can tell, the only way to explore this is on the client side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!