草庐IT

Implicit_cast

全部标签

android - 自定义全局应用程序类中断与 "android.app.Application cannot be cast to"

我有一个看起来像这样的自定义全局类importandroid.app.Application;publicclassMyAppextendsApplication{publicStringMainAct;publicStringgetMainAct(){returnMainAct;}publicvoidsetMainAct(StringmainAct){MainAct=mainAct;}}我想通过onCreate方法中的另一个Activity在此类中保留一个字符串。Stringlocal="myLocalVariable";((MyApp)getApplication()).setMa

android - 自定义全局应用程序类中断与 "android.app.Application cannot be cast to"

我有一个看起来像这样的自定义全局类importandroid.app.Application;publicclassMyAppextendsApplication{publicStringMainAct;publicStringgetMainAct(){returnMainAct;}publicvoidsetMainAct(StringmainAct){MainAct=mainAct;}}我想通过onCreate方法中的另一个Activity在此类中保留一个字符串。Stringlocal="myLocalVariable";((MyApp)getApplication()).setMa

ios - 警告 : Implicit conversion loses Integer precision in xcode 6

我知道它可能是重复的,但在将xcode更新到版本6后,我在我的ios项目中收到了大约30个隐式转换丢失整数精度警告。第一个例子:NSArray*stations=[selfstationsJSON][KEY_ITEM_LIST];intnewSize=(stations.count+1);//ImplicitconversionlosesIntegerprecision:'unsignedlong'to'int'第二个例子:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndex

ios - 警告 : "implicit declaration of function ' .。 .' is invalid in C99"

当我尝试比较两个UIColors的RGB分量时收到此警告在.h文件中,我声明了这一点-(int)ColorDiff:(UIColor*)color1:(UIColor*)color2;在.m文件中-(int)ColorDiff:(UIColor*)color1:(UIColor*)color2{...//getRGBcomponentsfromcolor1&color2//computedifferencesofred,green,andbluevaluesCGFloatred=red1-red2;CGFloatgreen=green1-green2;CGFloatblue=blue1

ios - Instagram 错误 : Implicit authentication is disabled

当尝试在mobileSafari中使用Instagram帐户登录我的应用程序时,我收到403错误:隐式身份验证已禁用. 最佳答案 出于安全原因,Instagram默认禁用OAuth2.0隐式身份验证流程(客户端身份验证)。如果您的应用程序没有服务器端,您应该转到ManageClientsSecurity部分并取消设置DisableimplicitOAuth选项。保存后一切正常。 关于ios-Instagram错误:Implicitauthenticationisdisabled,我们在S

http - flutter 错误 : type 'AddressInfo' is not a subtype of type 'String' in type cast

我制作了一个模型类并将其转发给一个putapi。但它显示错误type'AddressInfo'isnotasubtypeoftype'String'intypecast该类已正确序列化,我检查了映射的输出。此错误发生在httpput请求期间模型类@JsonSerializable()classAddressInfo{Stringcity;ListoperationAreas=newList();AddressInfo(this.city,this.operationAreas);factoryAddressInfo.fromJson(Mapjson)=>_$AddressInfoFro

android - flutter 错误 : type 'int' is not a subtype of type 'String' in type cast

我正在尝试使用Flutter应用从RESTAPI获取数据。我正在以json_serializable方式构建模型类。下面是我的代码。ma​​in.dartimport'package:flutter/material.dart';import'dart:convert'asconvert;import'package:http/http.dart'ashttp;import'./category.dart';voidmain(){runApp(MyApp());}classMyAppextendsStatefulWidget{@overrideStatecreateState(){//

dart - Flutter:_InternalLinkedHashMap 没有实例 > 方法 'cast'

Sthg让我发疯,我尝试在卡片中显示json产品,但它不起作用。到目前为止,这是我尝试过的:产品类别:classProduct{finalStringid;Product({this.id});factoryProduct.fromJson(Mapjson){returnnewProduct(id:json['id']asString);}}JSON:FutureloadProducts()async{finalresponse=awaithttp.get('https://api.stripe.com/v1/products');returnresponse.body;}json具有

flutter - 如何修复 : "The method ' cast' was called on null"during transaction. 更新

我在尝试对我的Firestore集合执行事务更新时收到NoSuchMethodError。Receiver:nullTriedcalling:cast()#0Object.noSuchMethod(dart:core/runtime/libobject_patch.dart:50:5)#1MethodChannel.invokeMapMethod(package:flutter/src/services/platform_channel.dart:331:19)#2Firestore.runTransaction(file:///Users/wready/dev_tools/flutt

flutter - Dart 类 'String' 没有实例方法 'cast'

我写了一个dart方法,它采用泛型类型T,然后尝试将动态类型转换为T。同样的错误。)在这个特定场景中,我将一个字符串作为T传递。下面一行抛出错误Tresult=value.cast();完整代码如下...classJsonObject{finalMap_map;JsonObject(this._map);TgetValue(Stringkey){dynamicvalue=_map[key];if(value==null)thrownewJsonParseException._("JsonMap:cannotfindvaluewithkey="+key);Tresult=value.ca