lundi 29 juin 2015

Does appcelerator studio work without internet connection once its installed?


My system specifications are : 

 Operating System Name         = Mac OS X

      Version                     = 10.10

      Architecture                = 64bit

      # CPUs                      = 4

      Memory                      = 4294967296

    Node.js

      Node.js Version             = 0.12.4

      npm Version                 = 2.10.1

    Titanium CLI

      CLI Version                 = 4.0.1

    Titanium SDK

      SDK Version                 = 4.0.0.GA

      SDK Path                    = /Users/systemname/Library/Application Support/Titanium/mobilesdk/osx/4.0.0.GA

      Target Platform             = iphone

The problem that i am facing is that i need continous internet connection for launching the app on device.Is there some setting which i can make to run without internet connection?

Thanks in advance.


Check if value is in sqlite database before adding


I am trying to preload some values into a database from a .csv file, but if they already exist then skip them. I am able to successfully parse the csv file then have the following function to check if they exist in the database:

func GetPreloadedDriverExists(manufacturer: String, model: String, size: Float, impedance: Int) -> Bool
{
    //1
    let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    let managedContext = appDelegate.managedObjectContext!

    //2
    let fetchRequest = NSFetchRequest(entityName:"Drivers")
    fetchRequest.propertiesToFetch = ["size"]
    fetchRequest.returnsObjectsAsFaults = false
    fetchRequest.predicate = NSPredicate(format: "(manufacturer MATCHES %@) AND (model MATCHES %@) AND (#size == %@) AND (impedance == %@) AND (isRemovable == FALSE)", "\(manufacturer)", "\(model)", "\(size)", "\(impedance)")

    //3
    var error: NSError?

    let fetchedResults:NSArray = (managedContext.executeFetchRequest(fetchRequest, error: &error))!

    return fetchedResults.count == 0 ? false : true
}

The first time through this return false as I would expect for all entries, but when I open the sqlite file on the device, it is blank. If I remove the condition to check if they already exist, the database populates correctly.

Here is the loop I am using to add the entries into the database.

if let managedObjectContext = self.managedObjectContext {
     for item in items {
     // Check if driver already exists in database, if not add it.
          if(!GetPreloadedDriverExists(item.manufacturer, model: item.model, size: (item.size as NSString).floatValue, impedance: (item.impedance as NSString).integerValue))
          {
               println("Value does not exist")
               let menuItem = NSEntityDescription.insertNewObjectForEntityForName("Drivers", inManagedObjectContext: managedObjectContext) as! Drivers
                        menuItem.manufacturer = item.manufacturer
                        menuItem.model = item.model
                        menuItem.size = (item.size as NSString).floatValue
                        menuItem.impedance = (item.impedance as NSString).integerValue

                if managedObjectContext.save(&error) != true {
                     println("insert error: \(error!.localizedDescription)")
                }
           }
      }
 }

Thank you for the help and any feedback.


Making a web proxy for ipads by using a iframe


To keep this short, I'd like to make a website that, using a iframe connects to my server and from their to any website the user wants this would allow ipads to connect to my site and through a proxy to access google, facebook, ect. Let me know if any more explanation is necessary P.S. - I cant use the built in vpn on ipads due to restrictions.


Unknown attribute 'objc_boxable' ignored?


I'm trying to typedef a struct and box it into a dictionary value. I tried this code from the clang website, but no dice:

typedef struct __attribute__((objc_boxable)) _SizeA {
    CGFloat height;
    CGFloat width;
} SizeA;

The typedef is warned `Unknown attribute 'objc_boxable' ignored.

Xcode 6.3 with iOS SDK 8.3 targeting 8.0. Is there a trick here I'm missing?


iOS: User inactivity/idle


I want to find the user in activity and do some operation if the user inactive for some times. I have used the below link to implement the inactivity: stack overflow question But issue is that the TIMERUIApplication is not invoked all times. When I killed the app and reopen it the TIMERUIApplication is not called and the notification is not fired. Does anyone have any idea about this. Thanks in advance.


Share Facebook permissions between Android and iOS


I'm developing an App for Android and iOS. One of the permissions I ask from Facebook is for the user friends, but since you can only get the friends that also gave permissions to your App and since I had to register an App of iOS and one of Android in Facebook from iOS I can only get the users that are using my App on iOS.

How can I get all the friends that gave permission of my App regardless of the platform?


UIAlertView for when fetching JSON fails


I'm trying to get this UIAlertView to run when fetching the JSON data fails, but i can't seem to get it to work. I'd appreciate it if someone could show me how to do it or point me in the right direction!