Unity3D - Parse Migration - ios

I have a Unity3D game currently hosted on parse. I am in the process of migrating it to mongoDB and Heroku. I have followed this link Parse Migration
Although its for iOS and I have tested it working on iOS, I am doing the same steps in Unity.
The code I am using in Unity3D is:
ParseClient.Initialize(new ParseClient.Configuration {
ApplicationId = "",
Server = "",
WindowsKey = ""
});
But nothing happens. If I initialize it like this on iOS, it works perfectly. But its not working on Unity. Any help would be greatly appreciated. Thank you

A while back when I was still using Parse I was using the ParseInitializeBehaviour.cs script attached in an object that persisted across scene changes.
The reason is that it does an additional call at the bottom apart from the ParseClient.Initialize() call.
I cannot find that script any more at current master though.

Related

React-Native ios App crashes without report

I'm building an iOS app using React Native and trying to get it testable on phones.
If I plug my phone into the computer and "build" directly to the phone, the app is built correctly and opens/operates correctly, no problem.
But if I try to archive it and send it to phones using iTunes Connect's TestFlight or Fabric with Crashlytics, the app crashes immediately upon opening. It briefly shows the launch screen, but no more.
Moreover, there are no crash reports -- in TestFlight, in Crashlytics, or in XCode, once I plug the phone back in. So I'm operating in the dark here, without any information on what's breaking. Haven't been able to find a similar issue online, so I figured I'd just ask. Any ideas what could be going wrong?
Please let me know if there's any code or other data you might need to see. Some of it's confidential, but I'll try to post an approximate version.
As Chris Geirman suggested, the problem was a JavaScript error. I'm not sure people with similar problems will find this thread, but in case they do, here is the weird error that was occurring.
I had created a simple ORM system, with a BaseModel and a bunch of models that inherited from it. The BaseModel constructor looked like this:
constructor(props = {}, relations = {}) {
Object.keys(props).forEach((k) => {
// Save props to object
this[k] = props[k];
});
this.relations = relations;
this.className = this.constructor.name;
}
That last line was the problem. On my local simulator and if I build the app to my phone by plugging it in, this works fine. As in, if a Message model inherits from BaseModel, calling var msg = new Message(data, relations); msg.className returns Message.
But something about bundling/archiving/sending the app through TestFlight or Fabric.io minifies and uglifies the JavaScript, such that the class names are changed. So instead, if I do this -- var msg = new Message(data, relations); msg.className -- I'll get back a random variable name, something like 't'.
This was a problem in my app, because my home page contained a switch statement that worked off of the className:
iconContent() {
return {
Message: {
icon: <Image style={styles.feedItemIconImage} source={ require('../assets/img/icon_message.png') } />,
color: c.grass
}, ...
}[this.props.className] // from the model item
}
But 'Message' wasn't, as expected, the value of this.props.className -- 't' was. And so, if I were to try to tunnel into, say, the color value, I'd hit an error, because I was trying to access the color property of null.
Why that didn't report, I don't know (I followed Chris's suggestions and installed Sentry, but it still seemed not to report that error).
But that's what was going on. Minification/uglification occurred only when I installed the app on a phone via TestFlight/Fabric, and that's why the app only crashed in those conditions.
Hope this saves anyone running into a similar bug from tearing out their hair.
I'd like to share my own experience of production stage crash, whereas everything worked fine in development stage.
I had the similar problem which caused by the Reactotron logger. Since I'm not bundling it in production stage, a single line of console.tron.log crashed my app with full stealth. (Its kinda my fault, since I didn't give a damn about my linter with 'no-console' setting)
Here's the code snippet I introduce in my root level file, root.js.
if (__DEV__) {
...
console.tron = Reactotron;
...
}
Hope somebody finds this before wasting time figuring out what's wrong.
Not sure if you still have this problem - but if you do, I'd recommend checking out Bugsnag for react native error reporting - which reports crashes in both the JavaScript layer as well as the native layers (java/cocoa).
One of the harder problems to solve in react native crash reporting (as Sasha mentioned) is restoring the original stack traces when using minification and/or obfuscation - this is handled in Bugsnag by providing full support for JS source maps, as well as iOS symbolication and Android Proguard support at the native layers.
Let me know if this helps - I'm a founder # Bugsnag

How to insert a record from an iOS swift app to an Azure mobile service database?

Without getting too complicated, how to upload a single quantum of data from an iOS app (using Swift) to an Azure mobile service database?
Specifically, how to actually use the table insert method which requires a MSItemBlock closure?
Here's the decorated method I'm hunting down:
itemTable.insert(<#item: NSDictionary?#>, completion: <#MSItemBlock?#>)
Sometimes you just want to do one simple thing without building an entirely perfect solution.
In my case, all I wanted was to insert/upload a record from my iOS app (using core data) to my Azure mobile service database. I didn’t want to use table controllers or full table management objects (not yet anyway) - just a brief “proof-of-concept” to test out a basic save and upload pattern.
What I had in place:
iOS app built in Xcode 6 using swift
CoreData linked up and working nicely
What I wanted to do:
After saving to local core data in my app, also insert a corresponding record to my Azure mobile service database
What I did:
Logged into my Azure portal and navigated to my mobile service
Selected the iOS platform, then opened the “Connect an existing iOS
app” link.
Followed the on screen instructions to:
Download the iOS SDK
Create an "Item" table (by simply clicking the provided button)
What I did next:
Dragged the downloaded sdk into my Xcode project
In my Bridging-Header.h file (generated for me by Xcode when I had
previously run “Create NSManagedObject Subclass…” commands on my
core data models) I added this import:
#import "WindowsAzureMobileServices/WindowsAzureMobileServices.h"
In AppDelegate.swift I added a constant reference to the AzureClient:
let client = MSClient(applicationURLString: "https://mymobileapp.azure-mobile.net/", applicationKey: “aAaBbBcCc…")
Finally:
Here's the function I was wanting to use:
itemTable.insert(<#item: NSDictionary?#>, completion: <#MSItemBlock?#>)
Accordingly, and in swift parlance, I used the following to insert a record up to
Azure heaven:
var client = AppDelegate().client // To reference my constant in AppDelegate.swift
var itemTable:MSTable = client.tableWithName("Item")
var itemToInsert:NSDictionary = ["text":"My Awesome Item 1"]
itemTable.insert(itemToInsert,
completion: {
insertedItem, error in
if error{
println("error: \(error)")
}
else{
println("Success!")
}
}
)
The expected/returned MSItemBlock in the insert method stumped me for a while until I read up a little on swift closures vs objc blocks.
Disclaimer: The above snippet worked for me in this particular case but in truth I'm a drunken monkey playing with matches at the moment, so I do realise there must be far more efficient ways of doing this. However, I could find absolutely nothing on the web about the MSItemBlock and its pattern of usage in Swift, so hopefully this might prove a starting point for anybody else struggling with a similar issue.
The iOS Swift quickstart for Azure Mobile Services will be available for download next portal update. In the meantime you can see it here, here's the insert line:
https://github.com/Azure/azure-mobile-services/blob/dev/quickstart/iOS-Swift/ZUMOAPPNAME/ZUMOAPPNAME/ToDoTableViewController.swift#L148
Inserting an item to the table should look like:
let originalItem = ["key":"value"];
itemTable.insert(originalItem) {
(item, error) in
// Logic here
}

Cordova resolveLocalFileSystemURL success call back failing on iOS

I've just created a new project and installed the file and file-transfer api's via CLI. I have already created a working app previously so I know how to use phonegap and have been doing so for a few years now.
Here is the code:
window.resolveLocalFileSystemURL("file:///localhost/var/mobile/Applications/96B4705C-C70D-4340-9A42-HJ1F28355D43/tmp/cdv_photo_015.jpg", function(fileEntry){
console.log(fileEntry.name);
}, function(error){
console.log('about to resolve this files errors');
console.log(error.code);
});
Nothing ever gets outputted in the console debugging window ...and yes I have debug installed cause I have console.log() in other parts of my code that show up.
It seems like there is an issue when passing URL data from navigator.camera.getPicture() to the file API when using window.resolveLocalFileSystemURL()...any ideas anyone. I'm up to date on phonegap api and everything and I have this issue for the past few days now...I can't seem to solve it.
***EDIT***
Seems like when you use Camera.DestinationType.FILE_URI as a parameter for navigator.camera.getPicture(). When you choose a picture and the success call back for navigator.camera.getPicture() is triggered, trying to window.resolveLocalFileSystemURL from the URL that getPicture returns just fails. But if you set Camera.DestinationType.NATIVE_URI it at least returns something but it's in a format that can't be used with the file-transfer api exp: assets-library://asset/asset.JPG?id=220BCEAE-F1EA-4A6A-83B2-AB8833A90BF2&ext=JPG
Seems like this was a bug in the file api v1.0.0
https://issues.apache.org/jira/browse/CB-6116
Temp solution is there as well.
Seems like "/local/" was causing the issue. Remove it from incoming uri's if it exist and the resolve should work.

Using Durandal with Phonegap/Cordova

I'm trying to develop a Cordova/Phonegap application using Durandal for IOS (using a Mac), and am having some trouble getting started.
I've got Cordova loading with RequireJs and that's all working fine. This is what I've got in my main.js file:
define(function (require) {
var
cordova = require('cordova.ios'),
system = require('durandal/system'),
//app = require('durandal/app');
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady () {
alert('Device is Ready!');
}
});
Notice I have app = require('durandal/app') commented out. If it IS commented out, then everything works fine. But as soon as I uncomment that, I don't get the alert anymore. I don't see anything out of the ordinary in the web inspector in Safari, and it seems like the app.js file gets loaded, but it stops everything else from happening there.
I know the docs say that you can use the optimizer, but is there no way to do the actual development in XCode and test without running the optimizer?
Thanks in advance for any help or ideas.
I believe there is an app variable in cordova, probably due to naming conflict. I created a sample and it worked with durandal. Please let me know if it doesnot work, i will post sample in github

ODataConsumer create method undefined - ADT - Build: v21.1.0-569685

I'm entering the world of android development, i haven't written java since uni (some time ago now). I have written and deployed a working WCF Data Service and am now attempting to consumer that service from my android app.
i've been reading blogs and following tutorials and everything starts with
ODataConsumer c = ODataConsumer.create("http://www.tooks-net.co.uk/DataService/PublicDataService.svc/");
List<OEntity> list = c.getEntities("NewsBulletins").execute().toList();
the problem that i am getting won't even let me run the app to see if the service will connect and retrieve the list of news. The error i get in eclipse is this:
The method create(String) is undefined for the type ODataConsumer
Like i said, all documentation says to start with ODataConsumer.create and it won't let me get even that far.
What i've done so far is. Follow the the android training programme here http://developer.android.com/training/basics/firstapp/index.html until the point where i create a new activity and start that, but instead of displaying the message entered i run the above code.
What have i missed? Thanks in advance!
You have to use
ODataConsumer c = ODataJerseyConsumer.create("http://www.tooks-net.co.uk/DataService/PublicDataService.svc");
Make sure that you added the clientbundle jar (the latest is odata4j-0.7.0-clientbundle.jar).

Resources