Posts tagged ‘WP7’

How To Fix TweetSharp After Recent Twitter Changes

Three days ago, I was contacted by a Tile Me! user telling me that the Twitter integration in the app did not work for him. I checked on my phone, everything was fine. I could also see other people were using it just fine too. So, I gave the default instructions of “Have you tried reinstalling the app?"’ which did not help 😦 .

Yesterday, I gave the user an account name and password that I control for app testing, just to see if the problem is with the app or the account he is trying to log in with. Lo and behold it works, while his accounts (yes he created several) don’t. That doesn’t make sense, does it?

After this, I decided to create a new Twitter account myself and test with that. Of course it does not work. I got in touch with Robert Shurbet and Sébastien Lachance who are both using TweetSharp in their apps. Robert said that he encountered this error before and he coded the authentication with a RestClient himself, while Sébastien was not aware of this issue which caused his app to crash altogether. The guy user that first reported this problem had created his Twitter account in February 2014. So, this problem might have been there for a while.

If you are using TweetSharp 2.3.0 (which is the stable version) or a modified 2.3.1, try creating a new Twitter account and see if you can log-in with it. If you can’t, read on.

The Problem

I noticed that the problem was with the access tokens. For some reason, TweetSharp  was returning a ‘null’ access token when I logged in with a newly created Twitter account. I examined the TwitterResponse object which at first glance seemed fine. The status said ‘OK’. But, clearly it was not OK. After digging some more, I found out that an inner exception had occurred during the processing of the access token and was logged in the TwitterResponse object.

The exception that was logged said something along the lines of “Value assigned is greater than Int32’. I thought that must be it. They probably changed the type of something from’ ‘int’ to ‘long’. To investigate further, I had to download the TweetSharp 2.3.0 source code.

Now that I could access the TweetSharp classes, I found out that the culprit was the ‘UserId’ in the OAuthAccessToken class.

The Solution

The solution was quite simple. Change the ‘UserId’ type from ‘int’ to ‘long’ and find what else I broke by doing that. After building the project, I got a few errors at a few lines in the TwitterService.OAuth.cs class where the ‘UserId’ property was used.

In order to fix the errors all I had to do was replace all the occurrences of:

UserId = Convert.ToInt32(query["user_id"] ?? "0"),

 

with:

UserId = Convert.ToInt64(query["user_id"] ?? "0"),

 

I built the project, replaced the .DLL that I was using from nuget with the newly compiled one, and voila everything was fixed. I also sent the .DLL to Sébastien which reported that the problem was fixed in his app as well.

If you want to edit the things yourself, download the source code and do the changes above. If you are lazy to do that, don’t worry, you can download the Windows Phone 8 .DLL I compiled from here. If you installed TweetSharp from nuget, just navigate to your project directory –> Packages –> TweetSharp.2.3.0 –> lib –> sl4-wp and replace TweetSharp.WindowsPhone.dll 

If you are using TweetSharp for WP7 or another platform, you’ll have to do the changes yourself (it’s the same ones).

Note: The developer has stopped supporting TweetSharp, so if you are creating a new app, use another alternative instead. I cannot guarantee that TweetSharp won’t break again anytime soon.  I heard Linq2Twitter is currently popular among developers.

Sparrow Beta Is Live!

Well that took longer than I expected, but finally, we got a playable version of Sparrow in the Windows Phone Store! Currently, it is hidden from the store because we submitted it as an invite-only beta to hunt down the bugs that we couldn’t find. We are planning to end the beta and release publicly once we are sure that we fixed all the reported bugs and balanced the game.

If you have a Windows Phone (7 or 8) device and are interested in testing the game out, let me know. Here are some screenshots from the beta:

 

 

 

 

 

 

 

 

 

 

 

We did a major change with the levels. Instead of having separate missions (which was taking a lot of time to create), we decided to start with a survival mode and procedurally generate the enemy waves. As you play the survival mode, you progress by upgrading your aircraft, switching to the next, more powerful aircraft if you don’t lose all your lives, pick up new weapons etc.

I do not want this post to be the ‘post-mortem’, I’m planning to write that after we release, so I will conclude with a few words about the beta. We worked quite a lot during the mayday and Orthodox Easter holidays to finish the beta version and I thought that’s it, now I can take a break for a few days… Wrong! We had to submit updates and fix bugs that were reported several hours after the beta was released.

There are 20 testers that have played the game and we got some valuable feedback. There were some performance issues, which I believe we finally sorted out and the game should run OK on any device. We still have to decide whether we should switch some effects that we do using the Mercury Particle Engine to ordinary sprite sheet animations to increase performance.

After we release on the WP store, we are planning to finish the Windows 8 port using MonoGame, and then depending on the popularity we will either continue adding more content or move to a new project which might not be a game, but it will probably have some game elements :). 

Until next time.

Getting a free windows phone dev center subscription using dreamSpark

There are many students in Macedonian Universities that have never heard about the DreamSpark program and its benefits. The number of students that know that Macedonia (and many other countries) is now supported by the Windows Phone Dev Center is even less. There are many Macedonian students that develop various apps on some of Microsoft’s platforms as part of their course projects, but they never bother to polish and make some money from their apps.

If you haven’t heard about DreamSpark before, you can check the FAQ here.

In this post, I will explain the process of getting a DreamSpark account (if your University is already part of the program) and how you can use your DreamSpark account to register for a free Windows Phone Dev Center subscription.

Prerequisites:

  • Microsoft Account (Live, Hotmail, Outlook etc.). If you do not have one, you can register here.

Registering a DreamSpark Account

Note: If you already have a DreamSpark account, you can skip this part.

To get a free student Windows Phone Dev Center subscription, you first need to have a verified DreamSpark account that is mapped to your Microsoft (Live) account.

To register on DreamSpark, click here.

You should be taken to a page that should look something like this (click on image for full size):

Fill the required fields and press ‘continue to verify’. If you are from Macedonia, choose the first entry in the list, Macedonia (FYROM). Currently there are two. This will take you to a page that should look something like this.

Now you need to verify your account. My university is already on DreamSpark so I can verify my account through my university. You can also use an ISIC Card or an Activation Code. When you are done, press Continue. If you made the same choice as I did above, you should be taken to a page that looks like this:

Enter your university address and click on ‘Verify’.

Mapping your Microsoft Account to your DreamSpark Account

The next step is to map your Microsoft account to your DreamSpark account. First go here and then press ‘map now’ as shown on the picture below.

Follow the instructions to map your account.

Joining Windows Phone Dev Center

To join the Windows Phone Dev Center, click here. You should be taken to a page that looks like this:

Click Join Now to continue.

On the next page, choose your Country and select ‘Individual or Student’. After your agree to the terms click Next. Then complete the contact form and press Next.

On the next step, choose ‘I’m a student’ and press next to verify.

Congratulations you’re done! You can now publish and sell Windows Phone apps on the Windows Phone Marketplace.

If the verification fails, you probably have not mapped your DreamSpark Account to your Microsoft Account. If you encounter any other problems, leave a comment below.