gpt4 book ai didi

objective-c - 枚举值 'SHKShareTypeUndefined' 未在开关中处理

转载 作者:IT王子 更新时间:2023-10-29 08:21:52 24 4
gpt4 key购买 nike

我在下面的代码中收到警告 Enumeration value 'SHKShareTypeUndefined' not handled in switch。我将相关的行和指针加粗了:

    + (NSArray *)favoriteSharersForType:(SHKShareType)type
{
NSArray *favoriteSharers = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"%@%i", SHK_FAVS_PREFIX_KEY, type]];

// set defaults
if (favoriteSharers == nil)
{
switch (type)
{
case SHKShareTypeURL:
favoriteSharers = [NSArray arrayWithObjects:@"SHKTwitter",@"SHKFacebook",@"SHKReadItLater",nil];
break;

case SHKShareTypeImage:
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail",@"SHKFacebook",@"SHKCopy",nil];
break;

case SHKShareTypeText:
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail",@"SHKTwitter",@"SHKFacebook", nil];
break;

case SHKShareTypeFile:
favoriteSharers = [NSArray arrayWithObjects:@"SHKMail", nil];
break;

case SHKShareTypeUndefined:
break;
}

// Save defaults to prefs
[self setFavorites:favoriteSharers forType:type];
}

此警告在 ShareKit 中,我不确定如何修复它。

谢谢!

最佳答案

为该枚举值添加虚拟大小写:

case SHKShareTypeUndefined:         
break;

或者在目标设置(警告部分)中将“检查开关语句”标志设置为 NO

关于objective-c - 枚举值 'SHKShareTypeUndefined' 未在开关中处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6996138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com