![](/img/trans.png)
[英]Type 'NSPersistentStore' does not conform to protocol 'BooleanType' in swift
[英]Type 'AnyObject' does not conform to protocol 'BooleanType'
這是我在目標c中的代碼
id locationValue = [launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey];
if (locationValue)
{
UIApplication *app = [UIApplication sharedApplication];
UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid;
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
}];
[self startLocationUpdates];
}
我將locationValue定義為AnyObjectType,並在標題符合該行時提到錯誤
if(locationValue)
我將其轉換為快速..所以請幫助..
if語句中任何條件的值都必須具有符合BooleanType協議的類型,這意味着條件必須是布爾表達式。
locationValue
不是布爾表達式,你想要if(locationValue != nil)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.