var params = ["first_name": firstnameTextFIEld.text,"last_name": lastnameTextFIEld.text,"company": companyTextFIEld.text,"email_address": emailTextFIEld.text,"phone_number": phoneTextFIEld.text]
接下来,我有ObjC框架,我连接到我的Swift应用程序.
里面有一个属性对象
@property (nonatomic,retain) NSMutableDictionary *fIElds;
我试图以这种方式分配它
object.fIElds = params
并得到一个错误:
Cannot convert the Expression's type '()' to type 'NSMutableDictionary!'
我也试过这样做
var params = ["first_name": firstnameTextFIEld.text,"phone_number": pnoneTextFIEld.text].mutablecopy() as NSMutableDictionaryobject.fIElds = params
编译得很好,但我遇到了运行时错误:
*** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
我打印了所有字段,但它们不是零:
println(firstnameTextFIEld.text)println(lastnameTextFIEld.text)println(companyTextFIEld.text)println(emailTextFIEld.text)println(pnoneTextFIEld.text)...12354
有任何想法吗?
尝试parms.brIDgetoObjectiveC().但是,这可能会给你一个NSDictionary而不是NSMutableDictionary. 总结以上是内存溢出为你收集整理的将Swift Dictionary转换为NSDictionary全部内容,希望文章能够帮你解决将Swift Dictionary转换为NSDictionary所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)