我今天使用此扩展代码,我仍然收到来自" archivate product"
内存内在函数的isvolatile参数必须是一个常量int调用 void @ llvm.memcpy.p0i8.p0i8.i64(i8 *%550,i8 * getelementptr inbounds ([2 x i8] * @ 6,i64 0,i64 0),i64%549,i32 0,i1%68),!dbg!1307 LLVM错误:找到破碎的功能,编译中止!
对此有任何帮助吗?
import UIKit
import NotificationCenter
import CoreData
import SwiftWidgetKit
class TodayViewController: UIViewController, NCWidgetProviding {
var data : NameForToday?
var user_data : UserInfo?
let context = CoreDataStore.mainQueueContext()
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
//self.preferredContentSize = CGSizeMake(0, 50);
super.viewDidLoad()
label.textAlignment = NSTextAlignment.Left
self.view.addSubview(label)
}
override func viewWillAppear(animated: Bool)
{
self.preferredContentSize = CGSizeMake(0, 40);
if (NSUserDefaults(suiteName: "group.sk.freetech.Meniny-Widget")?.boolForKey("my_first_launch") == false)
{
label.text = "Zapnite aplikáciu"
}
else
{
let name_data = GetName()
if (name_data.name_today == "NULL")
{
label.text = "Dneska neoslavuje nikto."
}
else
{
label.text = " " + name_data.name_today
}
println("mena \(name_data)")
}
}
func GetName() -> (name_today: String, name_tommorow: String)
{
let date = GetDate()
println("datumy \(date)")
var request_for_today = NSFetchRequest(entityName: "ListOfNames")
request_for_today.predicate = NSPredicate(format: "(month == \(date.actual_month)) AND (day == \(date.actual_day))")
var request_for_tommorow = NSFetchRequest(entityName: "ListOfNames")
request_for_tommorow.predicate = NSPredicate(format: "(month == \(date.tommorow_month)) AND (day == \(date.tommorow_day))")
var result_today:NSArray = context.executeFetchRequest(request_for_today, error: nil)!
var name_today:NSString
var result_tommorow:NSArray = context.executeFetchRequest(request_for_tommorow, error: nil)!
var name_tommorow:NSString
switch result_today.count
{
case 1:
var res = result_today[0] as NSManagedObject
name_today = res.valueForKey("name") as String
break
case 2:
var res_1 = result_today[0] as NSManagedObject
var res_2 = result_today[1] as NSManagedObject
name_today = (res_1.valueForKey("name") as String) + ", " + (res_2.valueForKey("name") as String)
break
case 3:
var res_1 = result_today[0] as NSManagedObject
var res_2 = result_today[1] as NSManagedObject
var res_3 = result_today[2] as NSManagedObject
name_today = (res_1.valueForKey("name") as String) + ", " + (res_2.valueForKey("name") as String) + ", " + (res_3.valueForKey("name") as String)
default:
var res = result_today[0] as NSManagedObject
name_today = res.valueForKey("name") as String
break
}
switch result_tommorow.count
{
case 1:
var res = result_tommorow[0] as NSManagedObject
name_tommorow = res.valueForKey("name") as String
break
case 2:
var res_1 = result_tommorow[0] as NSManagedObject
var res_2 = result_tommorow[1] as NSManagedObject
name_tommorow = (res_1.valueForKey("name") as String) + ", " + (res_2.valueForKey("name") as String)
break
case 3:
var res_1 = result_tommorow[0] as NSManagedObject
var res_2 = result_tommorow[1] as NSManagedObject
var res_3 = result_tommorow[2] as NSManagedObject
name_tommorow = (res_1.valueForKey("name") as String) + ", " + (res_2.valueForKey("name") as String) + ", " + (res_3.valueForKey("name") as String)
default:
var res = result_tommorow[0] as NSManagedObject
name_tommorow = res.valueForKey("name") as String
break
}
return (name_today, name_tommorow)
}
// Zistenie datumu
func GetDate() -> (actual_month: integer_t,actual_day: integer_t,tommorow_month: integer_t,tommorow_day: integer_t)
{
let date_today = NSDate();
let date_tommorow = NSDate(timeIntervalSinceNow: 60*60*24)
var format_month = NSDateFormatter()
format_month.dateFormat = "MM"
let actual_month : NSString = format_month.stringFromDate(date_today)
let tommorow_month : NSString = format_month.stringFromDate(date_tommorow)
var format_day = NSDateFormatter()
format_day.dateFormat = "dd"
let actual_day : NSString = format_day.stringFromDate(date_today)
let tommorow_day : NSString = format_day.stringFromDate(date_tommorow)
var actual_month_int = actual_month.intValue
var actual_day_int = actual_day.intValue
var tommorow_month_int = tommorow_month.intValue
var tommorow_day_int = tommorow_day.intValue
return (actual_month_int, actual_day_int,tommorow_month_int, tommorow_day_int)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)!) {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResult.Failed
// If there's no update required, use NCUpdateResult.NoData
// If there's an update, use NCUpdateResult.NewData
completionHandler(NCUpdateResult.NewData)
}
}
答案 0 :(得分:4)
我的解决方案只是在info.plist中更改Swift编译器代码生成 - >优化级别 - >调试 - >将全部更改为无[-Onone]