Invalid URL in iOS SDK Deezer player - deezer

I have problem with iOS SDK from Deezer. I initialize a connection with Deezer:
_deez = [[DeezerConnect alloc] initWithAppId:kDeezerAppId andDelegate:self];
// List of permissions available from the Deezer SDK web site */
NSMutableArray* permissionsArray = [NSMutableArray arrayWithObjects:#"basic_access", #"offline_access", #"manage_library", #"delete_library", nil];
[_deez authorize:permissionsArray];
Login is successfull.
After login I want to initialize a player I use:
_player = [PlayerFactory createPlayer];
[_player setPlayerDelegate:self];
[_player setBufferDelegate:self];
[_player preparePlayerForTrackWithDeezerId:trackid
stream:stream
andDeezerConnect:_deez];
And I get in bufferDidFailWithError:
Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0x194370a0 {NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x190894f0 "unsupported URL"}
Maybe the problem is in stream. What is that?
Thanks.

If you try to listen to an album or a playlist, do you check the "readable" value received with each track object ?
Example of JSon received for a track :
tracks = {
data = (
{
artist = {
id = 1234;
name = toto;
};
duration = 1;
id = 6789;
link = "";
preview = "";
rank = 1;
readable = 0;
stream = 0;
title = Title;
type = track;
},
If "readable" and "stream" are both equals to false, you can not read the track.

Related

Xcode when start zoomsdk meeting get error InvalidArguments

Using xcode to run DEMO sdk(zoom-sdk-ios-5.9.1.2191)
After logining in ZOOM successfuly,We run the the following code as below
MobileRTCMeetingStartParam * param = nil;
MobileRTCMeetingStartParam4LoginlUser * user = [[MobileRTCMeetingStartParam4LoginlUser alloc] init];
param = user;
param.meetingNumber = kSDKMeetNumber; // if kSDKMeetNumber is empty, it‘s a instant meeting.
param.isAppShare = false;
Then got the error 150

Post to friends timeline using the feed dialog example c# api

I am trying to post something on my friend's timeline and I keep on getting an error every time i try to do it. the code i am using is below. i wonder if the code is correct? Cause it doesn't work for me. Can you help?
dynamic parameters = new ExpandoObject();
if (!string.IsNullOrEmpty(action.Post.PictureLocalSource))
{
var pictureTracking = GetNextPhotoFromFolder(action.Post.PictureLocalSource);
if (pictureTracking != null)
{
// action.Post.Picture = pictureTracking.FBPictureRef; // org
action.Post.Link = pictureTracking.FBPictureRef;
action.Post.Picture = pictureTracking.TrackingFileName;
parameters.type = "";
}
}
parameters.to = action.FacebookPostTargetID;
//parameters.Add("from", MyFacebookID);
parameters.message=action.Post.Message.Trim();
parameters.link = action.Post.Link;
parameters.picture = action.Post.Picture;
parameters.source = action.Post.Source;
parameters.name = action.Post.Name;
string caption = action.Post.Caption;
if (caption.Length > 200)
caption = caption.Substring(0, 200);
parameters.caption = caption.Trim(); // "Σχετικά με το asfame.gr";
parameters.description=action.Post.Description;
string feedtype = "";
if (action.Type == ActionType.Comments)
feedtype = "comments";
else
feedtype = "feed";
parameters.method = feedtype;
result = Client.Post(parameters);
Facebook has removed the ability to post on friends wall from 6th feb,2013. checkout the official doc here http://developers.facebook.com/roadmap/completed-changes/ under subsection Removing ability to post to friends walls via Graph API from February 6, 2013 changes. Hope it helps.

How to get the display_name from the XML-RPC response in Objective C

In my iPhone app I am accessing a WordPress powered blog using XML-RPC WordPress APIs, and I am fetching the userlists through a XML-RPC method wp.getUsers connection. This is all working fine and I got the response as below (NSLog output):
2012-07-24 11:13:19.317 projectABC[1465:207] (
{
"display_name" = "Ravi Interior Design";
email = "info#xyz.com";
nicename = abiqsd;
registered = "2012-05-11 11:58:52 +0000";
"user_id" = 15;
username = abssid;
},
{
"display_name" = "qqHeuer";
email = "aheuer#xyz.com";
nicename = adamhequer;
registered = "2012-05-18 15:59:30 +0000";
"user_id" = 44;
username = adamhequer;
},
{
"display_name" = "Asdasm Rseyses";
email = "xyz#abc.net";
nicename = adaqmraeyes;
registered = "2012-06-02 18:51:06 +0000";
"user_id" = 160;
username = adaqmreyeqs;
},
Now I need to store only display_name in an NSArray, but I am not getting how to extract only display_name from the above XML-RPC response. How can I achieve this?
Assuming what you printing is NSArray of Dictionaries,
NSLog(#"%#",[yourArray valueForKeyPath:#"display_name"])
For array of Dictionaries.
int i;
NSMutableArray *display_name = [[NSMutableArray alloc] init];
for(i=0;i<[Arr count];++i)
{
[display_name addobject:[[Arr objectAtIndex:i] valueForKey:#"display_name"]];
NSLog(#"%#", [[Arr objectAtIndex:i] valueForKey:#"display_name"]);
}

share link facebook update status wall using c#(facebook SDK)

I am searching three days but not find solution of my problems. I hope you will help me solve my problems.
I succeeded to post on wall. But there is a problem when I post ds wall nobody (even my friends too) can see my post and not post on update status. Only I can see the wall post. I checked my facebook settings and wall posts property is public.
string[] extendedPermissions = new[] { "publish_stream", "offline_access" };
var fbLoginDialog = new FacebookLoginDialog(appId, extendedPermissions);
fbLoginDialog.ShowDialog();
if (fbLoginDialog.FacebookOAuthResult != null) {
if (fbLoginDialog.FacebookOAuthResult.IsSuccess) {
var fb = new FacebookClient(fbLoginDialog.FacebookOAuthResult.AccessToken);
dynamic result = fb.Get("/me");
string firstName = result.first_name;
string lastName = result.last_name;
string id = result.id;
dynamic parameters = new ExpandoObject();
parameters.message = "Check out this funny article";
parameters.link = "http://www.example.com/article.html";
parameters.picture = "http://www.example.com/article-thumbnail.jpg";
parameters.name = "Article Title";
parameters.caption = "Caption for the link";
parameters.description = "Longer description of the link";
parameters.actions = new { name = "View on Zombo", link = "http://www.zombo.com", };
parameters.privacy = new { value = "ALL_FRIENDS", };
parameters.targeting = new { countries = "US", regions = "6,53", locales = "6", };
dynamic result1 = fb.Post("me/feed", parameters);
I would suggest trying the following:
change parameters.privacy = new { value = "CUSTOM"}; and see if that helps.
be sure the friends are qualified in the targeting list.
be sure your app is not in sandbox mode otherwise, only developers/testers of the app can see the postings from that app.

Where can I find updated, live exchange rates?

How do I link live currency exchange rates to my iPhone app? First, anyone know any sites where I can get the exchange rates? And second, how do I link that to my app? I want to do what this app does. http://the-dream.co.uk/currencee/
Here is a blog post about this, however to recap, if you use TBXML you can do it with the methods below.
They do the following:
Assume you have made a mutable dictionary object as a class property called exchangeRates
Set's EUR as the base rate (value of 1.0)
Call the European Central Bank's exchange rate XML feed and parses it.
After you've called the loadExchangeRates() method you can obtain a specific exchange rate by doing:
NSDecimalNumber *rate = [NSDecimalNumber decimalNumberWithString:[self.exchangeRates objectForKey:#"USD"]];
Here are the methods:
- (void)loadExchangeRates {
// initialize rate array
exchangeRates = [[NSMutableDictionary alloc] init];
// Load and parse the rates.xml file
TBXML * tbxml = [[TBXML tbxmlWithURL:[NSURL URLWithString:#"http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"]] retain];
// If TBXML found a root node, process element and iterate all children
if (tbxml.rootXMLElement)
[self traverseElement:tbxml.rootXMLElement];
// add EUR to rate table
[exchangeRates setObject:#"1.0" forKey:#"EUR"];
// release resources
[tbxml release]; }
- (void) traverseElement:(TBXMLElement *)element {
do {
// Display the name of the element
//NSLog(#"%#",[TBXML elementName:element]);
// Obtain first attribute from element
TBXMLAttribute * attribute = element->firstAttribute;
// if attribute is valid
NSString *currencyName;
while (attribute) {
/* Display name and value of attribute to the log window
NSLog(#"%#->%# = %#",
[TBXML elementName:element],
[TBXML attributeName:attribute],
[TBXML attributeValue:attribute]);
*/
// store currency
if ([[TBXML attributeName:attribute] isEqualToString: #"currency"]) {
currencyName = [TBXML attributeValue:attribute];
}else if ([[TBXML attributeName:attribute] isEqualToString: #"rate"]) {
// store currency and rate in dictionary
[exchangeRates setObject:[TBXML attributeValue:attribute] forKey:currencyName];
}
// Obtain the next attribute
attribute = attribute->next;
}
// if the element has child elements, process them
if (element->firstChild)
[self traverseElement:element->firstChild];
// Obtain next sibling element
} while ((element = element->nextSibling));
}
I realise this question has been answered already, but for anyone else looking for a solution to this same issue, there's also a great JSON solution available at openexchangerates.org as well.
My first port of call would be to find a webservice that provides currency rates with a public API.
Then you'd need to integrate some functionality into your app that communicates with the API in order to get the information you need.
There might be some services that offer the exchange rates in an RSS feed or similar feed. You could then parse the XML downloaded from that feed into some objects that you can use in your app.
Average monthly exchange rates of GBP to other currencies you can find as xml in link -
string url = "http://www.hmrc.gov.uk/softwaredevelopers/rates/exrates-monthly-" +
month2SymbolsYear2SymbolsString + ".xml";
then you can load this xml into lists and use in your code -
string xmlStr;
using (var wc = new WebClient())
{
xmlStr = wc.DownloadString(url);
}
var doc = XDocument.Parse(xmlStr);
var currenciesCodes = doc.Root.Elements().Select(x => x.Element("currencyCode"));
var rates = doc.Root.Elements().Select(x => x.Element("rateNew"));
List<string> currenciesCodesList = new List<string>();
foreach (var code in currenciesCodes)
{
currenciesCodesList.Add(code.Value);
}
List<double> currenciesRatesToGBPList = new List<double>();
foreach (var rate in rates)
{
double rateDouble;
if (!Double.TryParse(rate.Value, out rateDouble))
{
errorMessage = "During monthly average exchanges rates loading from page" + "\r\n" +
url + "\r\n" +
"program found text value - " + rate.Value + "\r\n" +
"which can't be converted to double value" + "\r\n" +
"Program can't correctly form reports and will end now.";
return errorMessage;
}
currenciesRatesToGBPList.Add(rateDouble);
}