Post not yet marked as solved
I've looked into a good number of articles on how to do a multipart/form-data POST on iOS, but none really explain what to do if there were normal parameters as well as the file upload.I have used the multipart/form-data POST on iOS & I had written the following code and it is uploading data but not image data - (void)postWithImage:(NSDictionary *)dictionary{ NSString *urlString = [NSString stringWithFormat:@"YourHostString"]; NSURL *url = [NSURL URLWithString:urlString]; NSString *boundary = @"----1010101010"; // define content type and add Body Boundry NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; NSEnumerator *enumerator = [dictionary keyEnumerator]; NSString *key; NSString *value; NSString *content_disposition; while ((key = (NSString *)[enumerator nextObject])) { if ([key isEqualToString:@"file"]) { value = (NSString *)[dictionary objectForKey:key]; NSData *postData = UIImageJPEGRepresentation([UIImage imageNamed:value], 1.0); [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\";\r\nfilename=\"screen.png\"\r\n\r\n",value] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:postData]; } else { value = (NSString *)[dictionary objectForKey:key]; content_disposition = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", key]; [body appendData:[content_disposition dataUsingEncoding:NSUTF8StringEncoding]]; NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:value options:NSJSONWritingPrettyPrinted error:&error]; [body appendData:jsonData]; //[body appendData:[value dataUsingEncoding:NSUTF8StringEncoding]]; } [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; } //Close the request body with Boundry [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:body]; [request addValue:[NSString stringWithFormat:@"%d", body.length] forHTTPHeaderField: @"Content-Length"]; NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; NSLog(@"%@", returnString);}Can anyone please help me to get why image data is not uploading
Post not yet marked as solved
We are creating a framework using Xcode and it is working fine with Xcode 12.1 but not working on Xcode 12.2 & above.
When the adopter app imports the framework file it shows the below error
The compiler that produced it, 'Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Post not yet marked as solved
We are creating a custom framework using CI Jenkins build which is having Xcode 12 and try to import in another project which is using Xcode 11.6 and that shows the above error.
I am getting the above error while I am importing the above framework created by Xcode 12 but not working on Xcode 11.6.
Please provide the solution.
Post not yet marked as solved
Module compiled with Swift 5.3 cannot be imported by the Swift 5.2.4
We are creating a custom framework using CI Jenkins build which is having Xcode 12 and try to import in another project which is using Xcode 11.6 and that shows the above error.
We have tried "builddistributionflag" - Yes in the custom framework but we having the same error. We are installing our custom framework by using pod into projects.
Post not yet marked as solved
Can we check device has IMEI number or not programmatically in iOS for iPhone/iPad
Post not yet marked as solved
We want to send info and image data in on server in JSON format using rest api.We are sending parameters in dictionary format and image data with a key value pairPlease find the dummy JSON formatdata = {"customerInfo":{"first_name":"Pk","last_name":"Pk"},"otp":"1223"} image = {Image data}Please sugget me the code for above format
Post not yet marked as solved
We have tested the app on iPhone X,iPhone XS for these devices the view is getting displayed properly but for iPhone XR only Navigation controller hides.Following is the code we have writtenhomescreen = [[HomeScreenViewController alloc]initWithNibName:@"HomeScreenViewController" bundle:nil];UINavigationController *homeNavigationController = [[UINavigationController alloc] initWithRootViewController:homescreen];self.window.rootViewController = homeNavigationController;
Post not yet marked as solved
I was searching to get ios device serial number programmatically for App Store app.
Post not yet marked as solved
Can we access speaker for playing a recorded audio when there is an ongoing call in backgroud.
Post not yet marked as solved
e are using the following code[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Battery"]];But the code doesn't work.Are there any new redirection API for iOS 12.
Post not yet marked as solved
We are using IOKit frame for battery-related info but now we are not able to fetch data like battery voltage and current capacity for iOS 12 beta 9. Please let us know if there is an alternate way for it
Post not yet marked as solved
I have a UICollectionView added to a UIView in an app I am working on. Displayed in the UICollectionView I have a set of images pulled from Core Data. The vertical scrolling works fine but the scrollbar does not display until the user touches the UICollectionView.How can I make sure the scrollbar at the right is always visible so that an indication is given to the user that it is scrollable?I have used the following code[mycollectionView flashscrollindicators];Please suggest any other method to make it always visible
Post not yet marked as solved
What does this mean in layman terms. I've been rejected from the store for this reason.Guideline 2.3.8 - Performance - Accurate MetadataWe noticed the app icon displayed on the device and the large icon displayed on the App Store do not sufficiently match, which makes it difficult for users to find the app they just downloaded.Specifically, the app icon displayed on the device is blank.Please see attached screenshots for details.Next StepsTo resolve this issue, please update the smaller device icon to match the larger App Store icon. When users search for your app on their devices, they should be able to recognize it from the icon on the App Store.ResourcesSince the large app icon will be displayed for your app on the desktop App Store, we recommend you provide an attractive, original icon that meets the following requirements for both iPhone/iPod touch and iPad apps:- 512px square (do not scale-up smaller artwork, as this could appear pixelated and blurry)- 72ppi, RGB, flattened, no transparency- High quality JPEG,TIFF, or PNG image file format. (ZIP-compressed TIFF files are not acceptable)You can also preview image files before submitting them by clicking the filename to view them in a separate window. Note that the small icon that you include inside your app's binary will be used on the iPhone, iPod touch, or iPad Home screen when installed. For more on icon sizes, please review App Icons on iPad and iPhone.For resources on creating eye-catching icons, you may want to review the App Store Product Page information available on the Apple developer portal.I have changed all the icons but still, the app got rejected. I am using icons created from https://makeappicon.com site.I have checked both icons are looking same. Why is app getting rejected?Suggest me another website for app icon creator.Please reply as soon as possible
Post not yet marked as solved
We have AVAuthorizationStatus for Camera.Is there any authorization method for Face ID in Local Authetication Frame.If available please answer.
Post not yet marked as solved
I had written the following code snippetif ([contextNew canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {[contextNew evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"",nil) reply:^(BOOL success, NSError *error) {if(success){}else{} } }it comes in sucess block after verification of face.I want to handle face id permission alert.Please reply as soon as possible