我正在尝试将iPhone SDK集成到我的项目中。 (目标)
我有一些细微之处,我无法使其正常工作。
我已经按照指南https://developer.authorize.net/integration/fifteenminutes/ios
AuthNet *an = [AuthNet getInstance];
[an setDelegate:self];
[an mobileDeviceLoginRequest: mobileDeviceLoginRequest];
在上面的代码中,
an
保持为空,因为在调用getInstance()
时类AuthNet不会实例化。在README文件中,它说我必须打电话
[AuthNet authNetWithAPILoginID:@"YOUR_LOGIN_ID" andTransactionKey:@"YOUR_TRANSACTION_KEY" forEnvironment:ENV_TEST];
为了实例化单例。但是“ AuthNet”类中没有这样的方法。
我想念什么吗?
最佳答案
-(void)registerDevice
{
MobileDeviceRegistrationRequest *registrationRequest=[MobileDeviceRegistrationRequest mobileDeviceRegistrationRequest];
registrationRequest.anetApiRequest.merchantAuthentication.name=@"loginid";
registrationRequest.anetApiRequest.merchantAuthentication.password = @"password";
registrationRequest.mobileDevice.mobileDescription=@"asd";
registrationRequest.mobileDevice.mobileDeviceId=[[[UIDevice currentDevice] uniqueIdentifier]
stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
[AuthNet authNetWithEnvironment:ENV_TEST];
AuthNet *an = [AuthNet getInstance];
[an setDelegate:self];
[an mobileDeviceRegistrationRequest:registrationRequest];
}
调用此方法1st来注册您的设备。