এটি অর্জনের জন্য আমাদের উভয় অ্যাপে কোডের কয়েকটি লাইন যুক্ত করতে হবে
অ্যাপ্লিকেশন এ: যা আপনি অন্য অ্যাপ থেকে খুলতে চান। (উৎস)
অ্যাপ বি : অ্যাপ বি থেকে আপনি অ্যাপ এ খুলতে চান (গন্তব্য)
অ্যাপ এ জন্য কোড
এক্সএমএলের নীচে অতীতের অ্যাপ এ এর একটি ওপেন প্লিস্ট উত্স এবং প্লাস্টিক অফ অ্যাপে কয়েকটি ট্যাগ যুক্ত করুন
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.TestApp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>testApp.linking</string>
</array>
</dict>
</array>
এর অ্যাপ প্রতিনিধি ইন অ্যাপ্লিকেশন একটি - কলব্যাক এখানে পান
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
// You we get the call back here when App B will try to Open
// sourceApplication will have the bundle ID of the App B
// [url query] will provide you the whole URL
// [url query] with the help of this you can also pass the value from App B and get that value here
}
এখন অ্যাপ বি কোড এ আসছে -
আপনি যদি কেবল কোনও ইনপুট প্যারামিটার ছাড়াই অ্যাপ এ খুলতে চান
-(IBAction)openApp_A:(id)sender{
if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"testApp.linking://?"]]){
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"App is not available!" message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
}
আপনি যদি অ্যাপ বি থেকে অ্যাপ এ প্যারামিটারটি পাস করতে চান তবে নীচের কোডটি ব্যবহার করুন
-(IBAction)openApp_A:(id)sender{
if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"testApp.linking://?userName=abe®istered=1&Password=123abc"]]){
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"App is not available!" message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
}
দ্রষ্টব্য: আপনি কেবল টেস্ট অ্যাপ্লিকেশনটিই অ্যাপ খুলতে পারেন : লিঙ্কিং: //? সাফারি ব্রাউজারে