gpt4 book ai didi

ios - 'NSInvalidArgumentException',原因 : '+[NSDictionary dictionaryWithObjectsAndKeys:]:

转载 作者:行者123 更新时间:2023-11-29 02:53:43 24 4
gpt4 key购买 nike

int x = 5;
int t = 6;
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"books.book", @"og:type",
@"www.goodreads.com", @"og:url",
@"Snow Crash", @"og:title",
@"978-3-16-148410-0",@"books:isbn",
@"http://en.wikipedia.org/wiki/File:Snowcrash.jpg", @"og:image",
@"www.google.com",@"og:audio:url",
@"www.facebook.com",@"al:windows_universal:url",
@"www.facebook.com",@"al:windows_phone:url",
@"www.facebook.com",@"al:windows:url",
@"www.facebook.com",@"al:iphone:url",
@"www.facebook.com",@"al:ipad:url",
x,@"books:rating:value",
t,@"books:rating:scale",
@"In reality, Hiro Protagonist delivers pizza for Uncle Enzo’s CosoNostra Pizza Inc., but in the Metaverse he’s a warrior prince. Plunging headlong into the enigma of a new computer virus that’s striking down hackers everywhere, he races along the neon-lit streets on a search-and-destroy mission for the shadowy virtual villain threatening to bring about infocalypse. Snow Crash is a mind-altering romp through a future America so bizarre, so outrageous…you’ll recognize it immediately.", @"og:description",
@"Science Fiction",@"books:genre",
@"eu_es",@"books:language:locale",
@[@"en_us",@"ca_es",@"cs_cz"],@"books:language:alternate",nil];

正如您在上面看到的,我正在尝试创建一个字典,但是每当我运行代码时,我都会收到这样的错误。

2014-06-11 23:50:50.338 TestApp[8374:60b] *** Terminating app due to uncaught exception     'NSInvalidArgumentException', reason: '+[NSDictionary dictionaryWithObjectsAndKeys:]: second   object of each pair must be non-nil.  Or, did you forget to nil-terminate your parameter   list?'
*** First throw call stack:
(
0 CoreFoundation 0x00000001019ef495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010174e99e objc_exception_throw + 43
2 CoreFoundation 0x00000001019d27e3 +[NSDictionary dictionaryWithObjectsAndKeys:] + 1043
3 TestApp 0x000000010000724d -[CYCViewController postBooks:] + 1021
4 UIKit 0x00000001002fcf06 -[UIApplication sendAction:to:from:forEvent:] + 80
5 UIKit 0x00000001002fceb4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17
6 UIKit 0x00000001003d9880 -[UIControl _sendActionsForEvents:withEvent:] + 203
7 UIKit 0x00000001003d8dc0 -[UIControl touchesEnded:withEvent:] + 530
8 UIKit 0x0000000100333d05 -[UIWindow _sendTouchesForEvent:] + 701
9 UIKit 0x00000001003346e4 -[UIWindow sendEvent:] + 925
10 UIKit 0x000000010030c29a -[UIApplication sendEvent:] + 211
11 UIKit 0x00000001002f9aed _UIApplicationHandleEventQueue + 9579
12 CoreFoundation 0x000000010197ed21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
13 CoreFoundation 0x000000010197e5f2 __CFRunLoopDoSources0 + 242
14 CoreFoundation 0x000000010199a46f __CFRunLoopRun + 767
15 CoreFoundation 0x0000000101999d83 CFRunLoopRunSpecific + 467
16 GraphicsServices 0x0000000103b66f04 GSEventRunModal + 161
17 UIKit 0x00000001002fbe33 UIApplicationMain + 1010
18 TestApp 0x0000000100008153 main + 115
19 libdyld.dylib 0x00000001020875fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我已经通过添加 NIL 来遵循解决方案,但仍然不起作用。一切都安排得很好。我检查了又检查。

最佳答案

在你的字典中可以是nil的值是xt。上面的错误说对象不能是 nil,你不能用 nil 代替字典中一个键的对象,相反你可以尝试把@"" 或者您甚至可以提供 [NSNull null]

更新

正如你所想的那样

int x = 5;
int t = 6;

上面的值都是非对象值,字典需要对象,试试放。

[NSNumber numberWithInt:x]
[NSNumber numberWithInt:t]

关于ios - 'NSInvalidArgumentException',原因 : '+[NSDictionary dictionaryWithObjectsAndKeys:]:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24167435/

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