VK Social Network

VK

by Spiral Code Studio

View and activate on the Corona Store

VK.com plugin. The largest Russian social network. With this plugin you can perform actions like authentication, retrieving a profile, inviting friends, posting messages, etc.

Documentation

is it any russian documentation for this plugin?

Sorry, no. But it shouldn’t be too hard to translate for anyone.

Hi Lerg,

I’m trying to include the plugin but I’m not sure if there’s a way to open the VKontakte app for better integration. Is that possible or are we restricted to web login?

edit: I’m trying it out on iOS at the moment but the question stands for both.

By the way, I’m getting these 2 errors while trying to submit a distribution build to the store. Anything I can do to fix this @Lerg?

ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/Motus.app/VKSdkResources.bundle' does not contain a bundle executable. If this bundle intentionally does not contain an executable, consider removing the CFBundleExecutable key from its Info.plist and using a CFBundlePackageType of BNDL. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."

ERROR ITMS-90542: "Invalid CFBundleSupportedPlatforms value. The key 'CFBundleSupportedPlatforms' in the Info.plist file in bundle 'Payload/Motus.app/VKSdkResources.bundle' contains an invalid value '( "iPhoneSimulator" )'. Consider removing the CFBundleSupportedPlatforms key from the Info.plist. If this bundle is part of a third-party framework, consider contacting the developer of the framework for an update to address this issue."

Anything that you can help with, @Lerg?

hi,

i get the same two errors trying to upload a build. is there any solution?

Hi. I am back and now I am able to look into this issue. Sorry for the delay.

Official VK app should work for authentication by default. Web login is only used when no official VK app found.

It wasn’t easy, but I’ve fixed the issue. Updated to latest VK iOS SDK.

I didn’t try to upload to App Store, but there was a bug report for the original SDK and they said it was fixed.

Please try again.

I couldn’t get the VK app to launch but I’ll sure try it again. Is there something that I might be missing that prevents the VK app from launching?

Thank you for the fix. Hopefully, I will try it in the following week and write it down here if I have any problem.

I will check with the engineering team, but it might be that at this point it is not possible to launch official VK app on iOS 9. It should work on iOS 8.
Apple changed the behavior how apps open other apps by URLs, now you have to whitelist URLs you want to open. The docs on my website has been updated to include LSApplicationQueriesSchemes into build.settings. But it seems like it doesn’t work.

How should I get a custom fields from users.get ?

I’ve already tried 

vk.request('users.get', { first\_name, last\_name, photo\_100 }, 'GET', getListener) vk.request('users.get', { "fields=first\_name,last\_name,photo\_100" }, 'GET', getListener)

with no result, just id,first_name and last_name there is no photo_100 in response table

edit : finally I managed to get photo_100 with network.request, but I personally think it should be implemented in plugin.

Sadly plug in don’t allow us to login via the VK application, like facebook v4 plugin do.

So I looking forward to get more suitable plugin for VK implementations.

Sorry for a late reply.
In vk.request(), params are actually a key-value table.
So to get fields you write something like this:

vk.request('users.get', {fields = 'first\_name,last\_name,photo\_100'}, 'GET', getListener)

Also the plugin should work with the official VK app for authentication, on which platform and version it doesn’t work?

Hi.

I am using plugins-sample-vk (https://github.com/Lerg/plugins-sample-vk), I rewrite appId and build it to Android. I launch it on device and try to login to VK,  as a result i have this message: “{“error”:“invalid_request”,“error_description”:“sdk_package is incorrect”}”.

This error appears only on the Android.

Where is my mistake?

Probably there is a misconfiguration of your VK app on vk.com/dev
You can check this thread about the same error: https://github.com/VKCOM/vk-android-sdk/issues/10

Now it is ok, thx!

How i can attach picture.png in vk.request({ ‘wall.post’ )  ?

picture.png is file in Resources directory?

Can’t find time for making a proper example.

But basically everything is explained here
https://vk.com/dev/upload_files?f=%D0%97%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B0%20%D1%84%D0%BE%D1%82%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D0%B9%20%D0%BD%D0%B0%20%D1%81%D1%82%D0%B5%D0%BD%D1%83%20%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8F

Get upload server with https://vk.com/dev/photos.getWallUploadServer
Upload the photo using network.upload()
Get it’s ID in response.
Include the ID in the attachments field of the wall post.

Is there a way to get the session’s access token after a successful login?

I don’t see any reference to it in the docs.
Our app has a server side that will need the access token to make API calls to VK (to get friends list, etc)

stanga, hi, please remind me about that feature in a week. At the moment I can’t work on the plugin yet.

Hi Lerg, 

Just bumping the issue with the access token.

It would be great to use your plugin, but we need to know the user’s access token in order to do that. 

Thanks!