// CoreDataの取得
var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
var context:NSManagedObjectContext = appDel.managedObjectContext
var request = NSFetchRequest(entityName: "Setting")
request.returnsObjectsAsFaults = false;
request.predicate = NSPredicate(format: "key = %@", "myid")
var results = context.executeFetchRequest(request, error:nil)
if(results.count > 0){
// データがあった場合
var userdata : AnyObject = results[0]
var uid = userdata.valueForKey("value") as String
println(uid)
}else{
// データが無かった場合
var Setting = NSEntityDescription.insertNewObjectForEntityForName("Setting",inManagedObjectContext:context) as NSManagedObject
Setting.setValue("myid",forKey:"key")
Setting.setValue("dsdsdsssdsd",forKey:"value")
context.save(nil)
}