Send info regarding user via XMPP in iOS - iphone

I have implemented the chat and everything is working good. I follow that link http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/ tutorial to implement chat app. Now i want to send info regarding user like photo,birthday,nickname etc. So i just want to create that info and send to other user.
I also want to send image(Data) to another user.

To set an avatar and other user-information you should have a look at the vcard extension XEP-0153 (specification and implementation).
You will find an example implementation for the vCard within the XMPPFramework iphone demo.
You would use the following calls to update and fetch vCards:
- (XMPPvCardTemp *)fetchvCardTempForJID:(XMPPJID *)jid;
- (XMPPvCardTemp *)fetchvCardTempForJID:(XMPPJID *)jid useCache:(BOOL)useCache;
- (void)updateMyvCardTemp:(XMPPvCardTemp *)vCardTemp;
To send binary data, you have some options. The XMPPFramework implements XEP-0065. There are other methods to send data like:
XEP-0066: Out of Band Data
XEP-0096: SI File Transfer
XEP-0234: Jingle File Transfer
Which you could probably implement as extensions and integrate them into the XMPPFramework.
In will integrate sending binary data like images and videos myself soon. So please leave a comment about your implementation.

first setup user profire in spark and then use [XMPPvCardTempModule myvCardTemp]

Related

Swift 4, CorePlot, send chart via mail app (with MessageUI)

Can I somehow take the chart (which was made with CorePlot) from view and send it as a file to another person via mail app? I want to send mail with the help of MessageUI. I feel fine if just the picture will be sent.
Use the -imageOfLayer method to get a PNG of the graph or the -dataForPDFRepresentationOfLayer method to get a PDF and attach the resulting file to a message.

How to use standard events in the react native Facebook SDK

The Facebook SDK has the ability to record both custom events and standard events. The standard events are things like "Purchases" "Add to cart" "Completed Registration" etc...
Recording these standard events gives you access to specific bidding features on Facebook ads that you don't get without the events.
I have an app that has the React Native FBSDK
There are two methods for defining an event - one for purchases and one for everything else as seen here
There is zero documentation for standard events on react within the SDK on Github or on the event tracking docs on Facebook's developer platform.
Right now I'm trying to track the standard events by using their various names, as recorded across FB's documentation. I've tried the following:
AppEventsLogger.logEvent('FBSDKAppEventNameCompletedRegistration');
AppEventsLogger.logEvent('CompletedRegistration');
AppEventsLogger.logEvent('Completed Registration');
All of these just create custom events with those names, but aren't recognized as standard events.
Has anyone gotten standard events to work using the React Native wrapper for the FB SDK? If so how do you name the events to get FB to recognize them?
Update: As the comment below highlights, the more recent link is https://developers.facebook.com/docs/marketing-api/app-event-api/
It looks like you'll have to pass the strings that those standard events get evaluated to, i.e. instead of 'FBSDKAppEventNameCompletedRegistration', you'll have to use: 'fb_mobile_complete_registration'.
Here's the source:
Sorry if this is a bit late. Hope this helps.
I managed to find the actual event name by generating standard event code using tool on Facebook's documentation, run the code in AppDelegate.m, and get the exact key-values from Events Manager. With this roundabout way, I realized the actual name of Add to Cart event was fb_mobile_add_to_cart. From there I googled for the name and found the list documented in Marketing API (why not App Events?).
I don't know if it is the right place, but you can refer to https://developers.facebook.com/docs/marketing-api/app-event-api/ for actual standard event names and parameter names. At least it worked in my case. Here's my Add to Cart event code:
function logAddToCart(totalPrice, contentType, contentId, currency) {
const params = {
'fb_content_type': contentType,
'fb_content_id': contentId,
'fb_currency': currency
};
AppEventsLogger.logEvent('fb_mobile_add_to_cart', totalPrice, params);
}
I made a simple package with all events. Just import like
import FBEvents from "react-native-fbsdk-events";
// ...
AppEventsLogger(FBEvents.COMPLETE_REGISTRATITON, params);

Converse.js: How to display fullname from vCard in chatbox

I am using converse.js library to create XMPP client, but I can't figure out how to display user's full name (if have) from vCard instead of username in chatbox.
Is there some simple configuration solution, or I need to write custom plugin for it?
If the user has their full name set in a VCard it will automatically be set on their chat box as soon as the VCard has been fetched.
You can get it via converse.chats.open(jid).get('fullname').
UPDATE: in versions 3.0.0 and above, you need to register a plugin, and then in the plugin you can get it via:
_converse.api.chats.open(jid).get('fullname')
This happens asynchronously, so you might run into timing issues whereby you try to get the fullname before the VCard has been returned.
If you are writing your own custom view which you want to update automatically as stuff gets set, then you'll have to write a plugin so that you can have access to the underlying ChatBox Backbone.Model and can add an event listener for fullname.

Any example on how to implement the new VerificationController and the KNOWN_TRANSACTIONS_KEY constant?

I've been looking at implementing the new VerificationController to verify in-App-Purchases:
http://developer.apple.com/library/ios/#releasenotes/StoreKit/IAP_ReceiptValidation/_index.html
And I wonder if there is some example anywhere en how to validate a transaction, since it seems that the - (BOOL)verifyPurchase:(SKPaymentTransaction *)transaction; is not enough and it has to be implemented internally to verify the purchase when the data form the server is received.
Another question is if anyone has a clue on what the KNOWN_TRANSACTIONS_KEY is and how to fill it, is it just the product id of the purchase?
In the file "VerificationController.m", check this function:
- (void)saveTransactionId:(NSString *)transactionId
we can see, KNOWN_TRANSACTIONS_KEY is a key to be wrote to NSUserDefaults. So we don't need to touch it.
login iTunes Connect > Manage Your Apps > (click your app) > Manage In-App Purchases > click the link View or generate a shared secret (at bottom-left of the page)
it'll show us:
A shared secret is a unique code that you should use when you make the
call to our servers for your In-App Purchase receipts.
Just click Generate.
You can find a complete implementation over here: https://github.com/evands/iap_validation
RayWenderlich.com Tutorial
This article, In-App Purchases in iOS 6 Tutorial: Consumables and Receipt Validation on the RayWenderlich.com site, offers a download of Apple's code but fleshed-out (including Base64 methods) and tweaked.
You need to perform the validation on a transaction when it changes to one of the completion states:
SKPaymentTransactionStatePurchased
SKPaymentTransactionStateRestored
call the function:
[[VerificationController sharedInstance] verifyPurchase:transaction];
As you say it is not enough to just look at the return value. The function is asynchronous. You need to add some code to VerificationController.m where it says:
#warning Validation succeeded. Unlock content here.
There are also a few other lines with #warning in VerificationController.m where you need to deal with errors.
As for base64 another library you might want to look at using is:
http://www.imthi.com/blog/programming/iphone-sdk-base64-encode-decode.php
When it comes to
KNOWN_TRANSACTIONS_KEY
and
ITC_CONTENT_PROVIDER_SHARED_SECRET
I too would like to know what they are for and why and when they are needed.

How to get progress of sending image via bluetooth (Gamekit)?

I implement an application on iPhone which sharing photo via bluetooth(Gamekit).
I want to khow how to get a percentage of photo sending.
Please tell me.
Thanks
To keep under the maximum transferred data size you have to support breaking up your data.
Break up your data in, say, 10 fragments. Send each fragment in turn. Add up the percentages as each fragment is sent and recieved.
Alternatively have the recipient post back unreliably how much data has been received.